text stringlengths 14 410k | label int32 0 9 |
|---|---|
private static void repl(Environment env, TurtleGraphics t) {
System.out.println(version);
System.out.println("type 'exit' to quit.");
System.out.println();
Scanner in = new Scanner(System.in);
while(true) {
System.out.print(">");
try {
String line = in.nextLine();
if ("exit".equals(line)) { br... | 6 |
public static String compress (String str) {
char pre = str.charAt( 0 );
int count = 1;
char cur = ' ';
StringBuffer sb = new StringBuffer();
for (int i = 1; i < str.length(); ++i ) {
cur = str.charAt(i) ;
if ( cur == pre ) {
++count;
}else {
sb.append( pre );
sb.ap... | 2 |
public Guid readLegacyGuid()
throws IOException {
Guid guid = CycObjectFactory.makeGuid((String) readObject());
if (trace == API_TRACE_DETAILED) {
debugNote("readLegacyGuid: " + guid);
}
return guid;
} | 1 |
private void writeColorzz(int col, String dest) {
try {
OutputStream out = new BufferedOutputStream(new FileOutputStream(dest), 8096);
int i = 0;
int i2 = 0;
int step = 0;
int ii = 0;
while (i2 < biHeight) {
out.write(image.getVal(i, i2, col));
i... | 9 |
public static Object getProperty(Object obj, String propertyName)
{
if (obj == null)
return null;
try
{
BeanInfo info = Introspector.getBeanInfo(obj.getClass());
PropertyDescriptor[] descriptors = info.getPropertyDescriptors();
for (int i = 0; ... | 6 |
private boolean r_t_plural() {
int among_var;
int v_1;
int v_2;
int v_3;
int v_4;
int v_5;
int v_6;
// (, line 160
// setlimit, line 161
v_1 = limit - cursor;
... | 9 |
public static void selectionSort (int[] array) {
for (int barrier = 0; barrier < array.length - 1; barrier++) {
int elem = array[barrier]; //обращению к элементу масива медленнее, чем к локальной перменной. не нужно делать проверок на границы массива
int aIndex = barrier+1;
... | 4 |
@Override
public void run () {
byte buffer[] = new byte[4096];
String logBuffer = "";
int newLineIndex;
int nullIndex;
try {
while (is.read(buffer) > 0) {
logBuffer += new String(buffer).replace("\r\n", "\n");
nullIndex = logBuffer.... | 8 |
public UsuariHex carregaUsuari( String nom, String contrasenya, TipusJugadors tipus_jugador )
throws IllegalArgumentException, FileNotFoundException, IOException, ClassNotFoundException,
NullPointerException
{
if ( !UsuariHexGstr.getInstancia().existeixElement( getIdentificadorUnic( nom ) ) )
{
thr... | 4 |
private int closeSpecifications(List<SpecificationDocument> specificationDocuments, boolean checkForEdited)
{
int closedSpecifications = 0;
isClosingDocument = true;
boolean canceled = false;
Iterator<SpecificationDocument> iterator = specificationDocuments.iterator();
wh... | 8 |
int findNl(int next, int last) {
for (int i = next; i < last; i++) {
if (buffer[i] == '\n') return i;
}
return -1;
} | 2 |
public EventsBean getEventbean() {
return eventbean;
} | 0 |
private Browser(Manufacturer manufacturer, Browser parent, int versionId, String name, String[] aliases, String[] exclude, BrowserType browserType, RenderingEngine renderingEngine, String versionRegexString) {
this.id = (short) ( ( manufacturer.getId() << 8) + (byte) versionId);
this.name = name;
this.parent = p... | 2 |
double[] MSDFromList(My3DData data3d, int l, boolean do3D)
{
double MSDs[] =new double[(int) Math.sqrt(NumMarkers(l)+1)];
double MSDNums[] =new double[(int) Math.sqrt(NumMarkers(l)+1)];
APoint point,point2;
double SumDist2;
int adT; // deltaTime but in unit steps
for (int i=0;i<NumMarkers(l);i++) {
for... | 8 |
@Override
public double read() {
time += 1.0 / 44100;
if (!running) {
amplitude = (amplitude>0 ?(amplitude - (level) / (release * 44100)) : 0);
} else if (time <= attack) {
amplitude += peek / (attack * 44100);
} else if (time > attack && time <= attack + decay) {
amplitude += (level - peek) / (decay ... | 6 |
public int argOfInterestOfZ(MessageContent z) {
// we look for the argmax
if (debug>=3) {
String dmethod = Thread.currentThread().getStackTrace()[2].getMethodName();
String dclass = Thread.currentThread().getStackTrace()[2].getClassName();
System.out.print... | 5 |
public RegExMultiReplacementFileContentsHandler(String[] regexes, String lineEnding) {
super(lineEnding);
setRegExes(regexes);
} | 0 |
@SuppressWarnings("unchecked")
private int reloadRegisteredItems(){
int i = 0;
Validator validator = new Validator();
for (String itemName : registeredItems){
if (validator.verifyRegisteredItem(instance, items, recipes, itemName)){
CustomID customId = new CustomID(items.getString(Util.concatStrings(Consta... | 7 |
private void drawRestOfJPanelDisplay(Graphics g) {
int numberLeftInPack = cardStack.size();
if (numberLeftInPack > 0) {
aFaceDownCard.drawCard(g, this);
drawNumberInsideCardArea(g, aFaceDownCard);
}
drawGameInformation(g);
} | 1 |
@Override
public void setIdleTimeout(long idleTimeout) {
this.idleTimeout = idleTimeout;
} | 0 |
@Override
public void act(Table table) {
StringBuffer message = new StringBuffer();
message.append(table.tableRepresentation());
message.append("\n\nWhat would you like to do? Please input \"h\" for Hit or \"s\" for Stand...");
// get input from user
String input;
do {
input = (String) BlackjackGame.ge... | 7 |
@Override
public boolean
equals(Object o) {
if (o == this) {
return true;
} else if (o instanceof SQLQuery) {
SQLQuery oo = (SQLQuery)o;
return oo.builder.equals(this.builder)
&& oo.parameters.equals(this.parameters);
} else {
return false;
}
} | 3 |
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 |
public List<Integer> addCycle(int leftX, int leftY, int rightX, int rightY,
int[][] matrix) {
List<Integer> result = new LinkedList<Integer>();
if (leftX == rightX && leftY == rightY) {
result.add(matrix[leftX][leftY]);
return result;
}
for (int i = leftY; i <= rightY; i++) {
result.add(matrix[left... | 8 |
public Tilbakemelding opprettBruker(PreparedStatement setning, ResultSet res, Connection forbindelse, String brukernavn, String passord) {
Tilbakemelding returverdi = Tilbakemelding.nyBrukerIkkeOk;
try {
getBrukerData();
setning = forbindelse.prepareStatement("select brukernavn f... | 3 |
public void setBtn_Std_Fontsize(int fontsize) {
if (fontsize <= 0) {
this.buttonStdFontSize = UIFontInits.STDBUTTON.getSize();
} else {
this.buttonStdFontSize = fontsize;
}
somethingChanged();
} | 1 |
public void keepOnlyDuplexes() {
for (int i = 0; i < parent.tracks.size(); i++) {
for (int j = 0; j < parent.tracks.get(i).matches.length; j++) {
if (parent.tracks.get(i).matches[j] != 0) {
Track target = getTrackById(j);
if (target == null) {
parent.tracks.get(i).setMatch(j, 0);
} else if... | 5 |
private void add(Automaton newOne, Automaton other) {
AutomatonDrawer d1 = new AutomatonDrawer(newOne), d2 = new AutomatonDrawer(
other);
Rectangle2D bounds1 = d1.getBounds(), bounds2 = d2.getBounds();
if (bounds1 == null)
bounds1 = new Rectangle2D.Float();
if (bounds2 == null)
bounds2 = new Rectangle... | 7 |
private void fill() {
switch (difficulty) {
case "E":
readBoards(1);
break;
case "M":
readBoards(2);
break;
case "H":
readBoards(3);
break;
// case "A":
// ... | 3 |
public CompoundGenerator(QuestionGenerator... generators) {
if (generators == null || generators.length == 0) {
throw new IllegalArgumentException("No generators.");
}
Collections.addAll(this.generators, generators);
} | 2 |
protected void populate(Annotation[] annotations, String className)
{
if (annotations == null) return;
Set<String> classAnnotations = classIndex.get(className);
for (Annotation ann : annotations)
{
Set<String> classes = annotationIndex.get(ann.getTypeName());
if (classes == ... | 3 |
private void carregaFormasPagamento(){
FormasPagamentoDAO dao = new FormasPagamentoDAO();
listaFromasPagamento = dao.ListarTodos();
cbxTipoPagamento.removeAllItems();
for(FormasPagamento f : listaFromasPagamento){
cbxTipoPagamento.addItem(f);
}
... | 1 |
public String getRecommendListForAdamicAdar() {
String recommend = "";
try {
Class.forName("com.mysql.jdbc.Driver");
connect = DriverManager.getConnection("jdbc:mysql://localhost/NETWORK_TEST?"
+ "user=root&password=root");
connect.setAutoCommit(false);
statement = connect.createStatemen... | 8 |
public static void printGist(int[] arr) {
int[][] res = toPrintable(arr);
int maxDigits = maxDigits(arr);
for (int i = 0; i < res.length; i++) {
for (int j = 0; j < res[i].length; j++)
switch (res[i][j]) {
case WALL:
wall();... | 6 |
protected Farm() {} | 0 |
public static void main(String[] args) {
Connection conn = null;
PreparedStatement ps = null;
ResultSet reSet = null;
/* 开源数据连接池 */
// BasicDataSource dataSource = new BasicDataSource();
// dataSource.setDriverClassName("com.mysql.jdbc.Driver");
// dataSource.setUrl("jdbc:mysql://localhost/test");
// d... | 8 |
public static String get(String propertyName)
{
if (prop == null || prop.getProperty(propertyName) == null)
{
try
{
loadProperties(propertyFilePath);
}
catch (IOException e)
{
try
{
propertyFilePath = ".." + File.separator + propertyFilePath;
loadProperties(propertyFilePath);
... | 5 |
@Override
public void run() {
boolean shutdown = false;
try (Socket socket = this.socket) {
Request request = getRequest();
WebResponse response = new WebResponse();
if (request == null) {
WebLogger.log("request = null");
response.setError(Response.STATUS_BAD_REQUEST, "request == null");
} else... | 9 |
public void displayPoint(GeoPoint gp) throws IOException {
double marginBuffer = 0.2;
double sx = (Math.abs(gp.longitude - params.longMin) / (1 + marginBuffer) *
windowFactor + pWidth * marginBuffer / 2);
double sy = pHeight - (Math.abs(gp.latitude - params.latMin) / (1 + marginBuffer) *
wi... | 8 |
@Test
public void test_removePawn(){
assertNotNull(board);
board.removeAllPawns();
numberOfPawns=0;
assertEquals(numberOfPawns, board.numberOfPawns());
Pawn pawn1 = new Pawn('l', 3,4, board);
Pawn pawn2 = new Pawn('m', 2,3, board);
board.addPawn(pawn1);
... | 0 |
@Override
public void itemStateChanged(ItemEvent event) {
if (event.getStateChange() == ItemEvent.SELECTED) {
if (event.getItemSelectable().equals(supplierComboBox)) {
fillUpProductComboBox();
refreshTab(productComboBox.getSelectedIndex());
}
}
} | 2 |
public void addBlockDestroyEffects(int var1, int var2, int var3, int var4, int var5) {
if(var4 != 0) {
Block var6 = Block.blocksList[var4];
byte var7 = 4;
for(int var8 = 0; var8 < var7; ++var8) {
for(int var9 = 0; var9 < var7; ++var9) {
for(int var10 = 0; var... | 4 |
public static void insertAdress(Adress a){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedS... | 5 |
public PluginUpdate getUpdate(String userKey) {
PluginUpdate update = null;
try {
userKey = userKey == null ? "" : userKey;
String url = this.urlManager.getUpdate(Constants.APP_KEY, userKey, Utils.getPluginVersion().toString(true));
JSONObject jo = getJson(Methods.PO... | 4 |
public static void main( String [ ] args )
{
int numElements = 128;
int numInSameSet = 16;
DisjointSetsSlow ds = new DisjointSetsSlow( numElements );
int set1, set2;
for( int k = 1; k < numInSameSet; k *= 2 )
{
for( int j = 0; j + k < numElements; j += 2 * k )
{
... | 4 |
public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equals... | 6 |
@EventHandler(priority = EventPriority.HIGHEST)
public void onSignChange(SignChangeEvent event)
{
Block block = event.getBlock();
if(block.getState() instanceof Sign)
{
int line = CustomFunction.findKey(event.getLines());
if(line == -1) return;
if(event.getLine(line).equalsIgnoreCase("["+ Conf... | 6 |
public int getPortalAt(final Location check){
if(check.getBlock().equals(one.getBlock())) return 1;
else if(check.getBlock().equals(one.getBlock())) return 2;
return 0;
} | 2 |
private OthelloBoardBinary(){} | 0 |
public String getTitle() {
return title;
} | 0 |
private void defineMonitor ()
{
GraphicsDevice GDev = InfoLauncher.instance().getLocation().getGDev()[ InfoLauncher.instance().getLocation().getGDevice() ];
System.out.println( InfoLauncher.instance().getLocation().getGDevice() );
Dimension screenEnd = new Dimension( GDev.getDisplayMode().g... | 9 |
@Override
public void run() throws IOException {
int in = 0;
draw();
m_IO.flush();
do {
// get next key
in = m_IO.read();
switch (in) {
case BasicTerminalIO.LEFT:
case BasicTerminalIO.UP:
if (!sel... | 9 |
public static void pprintLiteralWrapper(LiteralWrapper self, org.powerloom.PrintableStringWriter stream) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(self);
if (Surrogate.subtypeOfBooleanP(testValue000)) {
{ BooleanWrapper self000 = ((BooleanWrapper)(self));
stream.print(self... | 8 |
private void configurePath() {
// Configurar carpeta de usuario
USER_HOME = System.getProperty("user.home"); //$NON-NLS-1$
// Configurar carpeta de aplicacion
File appDir = new File(USER_HOME + "\\TH Solution\\"); //$NON-NLS-1$
if (!appDir.exists() || !appDir.isDirectory()) {
boolean result = appDir.mk... | 8 |
public CtConstructor getConstructor(String desc)
throws NotFoundException
{
CtMember.Cache memCache = getMembers();
CtMember cons = memCache.consHead();
CtMember consTail = memCache.lastCons();
while (cons != consTail) {
cons = cons.next();
CtConstruc... | 3 |
public String guardar (){
if("".equals(nombre) || "".equals(carrera) || "".equals(edad) || "".equals(correo) || "".equals(contraseña) ||
"".equals(carnet) || "".equals(año) || "".equals(telefono) || "".equals(direccion)){
FacesContext.getCurrentInstance().addMessage(null, new FacesMess... | 9 |
public static HashMap<Integer, HashMap<Character, Integer>> initLanguagesMap(
String[] frequencies) {
HashMap<Integer, HashMap<Character, Integer>> mapOfLanguageFreq = new HashMap<Integer, HashMap<Character, Integer>>();
// Build correct amount of maps
for (int i = 0; i < frequencies.length; i++) {
mapOfL... | 3 |
private void set_agent(String agent, String type)
{
AgentEnum a = AgentEnum.valueOf(type);
switch(a)
{
case DNSServer:
DNSServer dnss = new DNSServer(agent, this.dns_table);
this.agents.put(agent, dnss);
break;
case FTPClient:
FTPClient ftpc = new FTPClient(agent);
this.agents.put(agent... | 6 |
public double getTotal() {
return total;
} | 0 |
public static boolean delete (Object bean) {
String sql;
PreparedStatement stmt=null;
try{
if(bean instanceof Patient){
sql = "DELETE FROM patients WHERE pid = ?";
stmt = conn.prepareStatement(sql);
return deletePatient((Patient)bean, stmt);
}
if(bean instanceof Employee){
sql = "DE... | 8 |
public void transform() {
changed = true;
while (changed) {
changed = false;
propagate();
}
} | 1 |
private boolean hasNetherPerms(Player playerToCheck)
{
boolean hasPermission = false;
try
{
if(playerToCheck.hasPermission("modgod.nether"))
{
hasPermission = true;
}
}
catch(Exception ex)
{
// player is probably n... | 2 |
public ItemSetChooser(Grammar grammar, Component parent) {
this.grammar = grammar;
this.parent = parent;
chooseTable = new GrammarTable(new ImmutableGrammarTableModel(grammar));
chooseTable.addMouseListener(GTListener);
choiceTable = new GrammarTable(new ImmutableGrammarTableModel());
JScrollPane p = new JS... | 0 |
public static void loadData(File file) throws FileNotFoundException{
if(!file.exists())
throw new FileNotFoundException("Could not find file.");
YAMLFile data = new YAMLFile(true);
data.Load(file);
VirtualAudioCableManager.getManager().frame.getExField().setText(
data.getString("exeFolder"));
Vir... | 6 |
public String getQuantity() {
if (quantity==0) {
return "";
}
else if(quantity%1==0 || quantity == 1){
return ""+(int)quantity;
}
return String.valueOf(quantity);
} | 3 |
private boolean isPlaceable(int col, int row) {
if (row < 0 || row >= size)
throw new IllegalArgumentException(
"isPlaceable : row "
+ row + "parameter out of bounds, must be between 0 and "
+ size);
if (col < 0 || col >= size)
throw new IllegalArgumentException(
"isPlaceable : col ... | 6 |
public List<Task> sort(final int colIndex, final boolean sortDown)
{
getTasks();
if(colIndex >= 0 && colIndex <= 6)
{
Collections.sort(tasks, new Comparator<Task>()
{
@Override
public int compare(Task arg0, Task arg1)
{
int result = 0;
if (colIndex == 1 || colIndex == 2 || co... | 9 |
public static void main(String[]args){
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int m = in.nextInt();
int c = in.nextInt();
TreeMap<Integer,TreeSet<Integer>> h = new TreeMap<>();
for (int i = 1 ; i <... | 6 |
private void render() {
if (texture != null) {
texture.bind();
}
data.bind();
data.draw(GL11.GL_TRIANGLES, 0, idx);
data.unbind();
renderCalls++;
} | 1 |
public void updateRangeListener(String resource, int rangeToAdd) {
GameActor actor = actors.get(resource);
if(actor == null) {
createPrototype(resource);
actor = actors.get(resource);
}
WeaponsComponent wc = (WeaponsComponent)actor.getComponent("WeaponsCo... | 1 |
public static Elements decoder(char s) throws PusherException {
switch (s)
{
case 'x' : return WALL;
case '*' : return BOX;
case '&' : return GOAL;
case '.' : return EMPTY;
}
throw new PusherException("no such element " + s);
} | 4 |
private HibernateSessionFactory() {
} | 0 |
public edit()
{
this.requireLogin = true;
this.addParamConstraint("id", ParamCons.INTEGER);
this.addParamConstraint("name", true);
this.addParamConstraint("capacity", ParamCons.INTEGER, true);
this.addRtnCode(405, "permission denied");
this.addRtnCode(406, "venue not found");
this.addRtnCode(201, "alread... | 0 |
@Override
public String toString() {
String ret = null;
switch(suit){
case CLUBS:
ret = "C";
break;
case DIAMONDS:
ret = "D";
break;
case HEARTS:
ret = "H";
break;
case SPADES:
ret = "S";
break;
default:
//Do nothing.
}
switch(value){
case 14:
ret += "A";
break;
c... | 8 |
private static void loadData(Library library) throws FileNotFoundException, IOException {
BufferedReader in = new BufferedReader(new FileReader("data.csv"));
while (in.ready()) {
String line = in.readLine();
if (line.startsWith("#")) continue;
String... | 7 |
public boolean comprobarEstado() {
int numVivas = 0; // numero de vecinas vivas
nuevoEstado = estado;
for (int i = 0; i < numVecinas; i++) {
if (vecina[i].estado) numVivas++;
}
if (estado) {
if (numVivas < 2) // muerte por soledad... | 6 |
public void Initialize() {
try {
Class.forName(this.dbDriver);
}
catch (ClassNotFoundException ex) {
System.out.println("Impossible d'initialiser le driver.\n" + ex.getMessage());
}
} | 1 |
public Button(JButton button) {
this.button = button;
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
if (clickHandler != null)
clickHandler.run();
}
});
} | 1 |
public void findAndRandomizeSpawnpoints(Tile topTile){
Tile currentJTile = topTile;
for(int j = 0; j < dimension; j++){
Tile currentKTile = currentJTile;
for(int k = 0; k < dimension; k++){
if(currentKTile.tileType == TileType.SPAWN){
freeSpawnpoints.add(currentKTile);
}
currentKTile = currentKT... | 3 |
public long add(long millis, long value) {
int year = iChronology.year().get(millis);
int newYear = year + (int)TestGJChronology.div(value, 12);
if (year < 0) {
if (newYear >= 0) {
newYear++;
}
} else {
if (newYear <= 0) {
... | 6 |
@RequestMapping(value = "/employee/skillset/{employeeId}", method = RequestMethod.GET)
@ResponseBody
public String getEmployeeSkillSet(@PathVariable String employeeId)
throws JsonGenerationException, JsonMappingException, IOException {
ObjectMapper objectMapper = new ObjectMapper();
ObjectNode objectNode = obj... | 0 |
public Metrics(final Plugin plugin) throws IOException {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null");
}
this.plugin = plugin;
// load the config
configurationFile = getConfigFile();
configuration = YamlConfiguration.load... | 2 |
public static void process(Configuration config) {
String dirName = config.getInputdir();
MappingTable mt = new MappingTable(config.getMapfile(), config);
logger.info("Processing files in " + dirName + ".");
// Actually process all the files.
Path path = Paths.get(dirName);
FileProcessor fp = new FileProcessor(m... | 5 |
protected Area getParentArea()
{
if((parentArea!=null)&&(parentArea.get()!=null))
return parentArea.get();
final int x=Name().indexOf('_');
if(x<0)
return null;
if(!CMath.isNumber(Name().substring(0,x)))
return null;
final Area parentA = CMLib.map().getArea(Name().substring(x+1));
if((parentA==nul... | 7 |
public Exponential(int mean, Random rnd)
{
this.mean = mean;
this.rnd = rnd;
} | 0 |
public void testCheckMinIdleKeyedObjectPoolKeys() throws Exception {
try {
@SuppressWarnings("unchecked")
final KeyedObjectPool<String, Object> pool = createProxy(KeyedObjectPool.class, (List<String>)null);
PoolUtils.checkMinIdle(pool, (Collection<String>)null, 1, 1);
... | 8 |
private String getNameTypeObj(String objName) {
return objName.substring(nameGameWorld.length());
} | 0 |
public static Proposition findEquatingProposition(Stella_Object directobject, LogicObject indirectobject) {
{ Stella_Object indirectobjectvalue = Logic.valueOf(indirectobject);
Stella_Object backlinkedindirectobject = indirectobjectvalue;
if (!Stella_Object.isaP(backlinkedindirectobject, Logic.SGT_LOGI... | 8 |
public void initGame(World w, int matchNum, int total) {
world = w;
match = matchNum;
totalMatches = total;
setXYasVertex(false); //RECOMMENDED: leave this as FALSE.
setHeight(HEXSIZE); //Either setHeight or setSize must be run to initialize the hex
} | 0 |
public void testNullValuesToGetInstanceThrowsException() {
try {
UnsupportedDateTimeField.getInstance(null, null);
assertTrue(false);
} catch (IllegalArgumentException e) {
assertTrue(true);
}
} | 1 |
public void run() {
if(url != null)
{
// Obtain the results of the project's file feed
if(readFeed())
{
if(versionCheck(versionTitle))
{
String fileLink = getFile(versionLink);
... | 6 |
public static double Levenshtein(String s, String t) {
if (s.length() == 0)
return t.length();
if (t.length() == 0)
return s.length();
int matrix[][] = new int[s.length() + 1][t.length() + 1];
for (int i = 0; i <= s.length(); i++)
matrix[i][0] = i;
for (int i = 0; i <= t.length(); i++)
matrix[0][i... | 7 |
public static void main(String[] args) {
System.out.printf("Veuillez entrez votre année de naissance : ");
Scanner myScan = new Scanner(System.in);
int anneeNaissance = myScan.nextInt();
int anneeCourante = Calendar.getInstance().get(Calendar.YEAR);
int age = anneeCourante - anneeNaissance;
if (anneeNaissa... | 9 |
public final void tick() {
step += 1;
if (--timeUntilAddRandomGrass < 0) {
timeUntilAddRandomGrass = 10;
for (int i = 0; i < Parameter.REGROWTH_RATE.getValue(); ++i) {
addRandomGrass();
}
}
for (final Entity e : entities) {
... | 5 |
public void leaving(final String name, final Object o) {
info(StringUtils.shortName(o.getClass()) + "-" + o.hashCode() + " leaving " + name + "()");
} | 0 |
@Override
public ClassMap readClassMap(SymbolSet ss, int fixed, boolean readNames) throws IOException {
ClassMap ret = new ClassMap();
// load the names if necessary
if(readNames) {
String r = reader.readLine();
int numNames = Integer.parseInt(r);
while(numNames-- != 0)
ret.addClass(reader.readLine(... | 9 |
@Override
public void keyReleased(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_F1)
{
System.out.println("F1 Key Released! Toggling Debug Grid!");
if(DRAW_DEBUG_GRID == false)
{
this.showDebugGrid(true);
}
else
{
this.showDebugGrid(false);
}
}
} | 2 |
public static void main(String[] args) {
System.out.print("Zadej cislo: ");
int sirka = VstupInt.ctiInt();
System.out.print("Zadej cislo: ");
int delka = VstupInt.ctiInt();
for (int i = 0; i < delka; i++) {
for (int j = 0; j < sirka; j++) {
if ((i == 0) || (i == (delka -1)))
... | 6 |
public void populateUserList(ArrayList<User> users) {
userListPanel.removeAll();
for (final User u : users) {
ImageIcon avatar = new ImageIcon(ImageManager.getInstance().getImage("graphics/avatars/" + u.getAvatarFilename()).getImage().getScaledInstance(35, 35, Image.SCALE_DEFAULT));
... | 9 |
protected void fireReceiveMessage(final ISocketServerConnection ssc,
IRemoteCallObjectMetaData meta, IRemoteCallObjectData data,
final long connectionId) throws Exception {
if (!meta.getExecCommand().equalsIgnoreCase(ISession.KEEPALIVE_MESSAGE)) {
ssc.setLastAccessTime(new Date().getTime()... | 1 |
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.