text stringlengths 14 410k | label int32 0 9 |
|---|---|
public Response serve(Request request) throws InterruptedException {
authener.authen(request);
if (request.uri.equals("/")) {
Response welcome = serveFile(request.uri, request.header,
getHomeDir(), true);
welcome.markNoCache();
return welcome;
} else if (request.getCookie("d") != null
&& reque... | 8 |
public static void main(String args[]) {
//<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://download.oracle.com/java... | 6 |
public void decoder(int[] octets_data){
if (taille ==5) {
vitesseXhigh = octets_data[0];
vitesseYhigh = octets_data[1];
vitesseXlow = octets_data[2];
vitesseYlow = octets_data[4];
arret_obst = (octets_data[5] & 0x10) >>> 4;
etat_capt_av_ar = (octets_data[5] & 0x6) >>> 2;
sens_deplacement = (octet... | 1 |
final int[][] getVertexGroups(boolean bool, int i) {
anInt1845++;
int[] is = new int[256];
int maximumGroup = 0;
int amountVertices = (!bool ? ((Model) this).anInt1821
: ((Model) this).vertices);
for (int vertex = 0; vertex < amountVertices; vertex++) {
int group = ((Model) this).vgroups[vertex];
... | 8 |
private int bsR(final int n) throws IOException {
int bsLiveShadow = this.bsLive;
int bsBuffShadow = this.bsBuff;
if (bsLiveShadow < n) {
final InputStream inShadow = this.in;
do {
int thech = inShadow.read();
if (thech < 0) {
... | 3 |
public boolean ApagarTodosQuandoExcluiPessoa(int idPessoa){
try{
PreparedStatement comando = banco.getConexao()
.prepareStatement("UPDATE telefones SET ativo = 0 WHERE id_pessoa= ?");
comando.setInt(1, idPessoa);
comando.executeUpdate();
coman... | 1 |
public boolean exit() {
int reponse = analyseSave.closeProgram();
if ( reponse == JOptionPane.YES_OPTION || reponse == JOptionPane.NO_OPTION ) { // Bug #348263
saveProperties();
System.exit(0);
}
if ( reponse == JOptionPane.CANCEL_OPTION ) // c'est fait exprès ( chemin tortueux à modifier )
... | 3 |
public Layer getActiveLayer(ArrayList<Layer> l) {
for (Layer layer : l) {
if (layer.isActive()) {
return layer;
}
}
return null;
} | 2 |
public TuringBruteParseAction(GrammarEnvironment environment) {
super("Parser for Converted Grammar from TM", null);
this.environment = environment;
this.frame = Universe.frameForEnvironment(environment);
} | 0 |
public void updateParticle(Particle particle, int delta) {
particleCount++;
particle.adjustVelocity(windFactor.getValue(0) * 0.00005f * delta, gravityFactor
.getValue(0) * 0.00005f * delta);
float offset = particle.getLife() / particle.getOriginalLife();
float inv = 1 - offset;
float colOffset = 0;
... | 8 |
private void resaveParamsShowCountry(SessionRequestContent request) {
String validCountryStatus = request.getParameter(JSP_COUNTRY_VALID_STATUS);
if(validCountryStatus != null) {
request.setSessionAttribute(JSP_COUNTRY_VALID_STATUS, validCountryStatus);
}
String invalidCount... | 4 |
public static boolean isEmpty() {
return buffer == EOF;
} | 0 |
public void dumpExpression(TabbedPrintWriter writer)
throws java.io.IOException {
if (!isInnerMost) {
writer.print(writer.getClassString(classInfo, Scope.AMBIGUOUSNAME));
writer.print(".");
}
writer.print("this");
} | 1 |
public String toBoardString() {
switch (this) {
case JACK_MUSTARD:
return "Y";
case KASANDRA_SCARLETT:
return "R";
case DIANE_WHITE:
return "W";
case JACOB_GREEN:
return "G";
case ELEANOR_PEACOCK:
return "B";
case VICTOR_PLUM:
return "P";
default:
throw... | 6 |
protected void readSampleData()
{
boolean read_ready = false;
boolean write_ready = false;
int mode = header.mode();
int i;
do
{
for (i = 0; i < num_subbands; ++i)
read_ready = subbands[i].read_sampledata(stream);
do
{
for (i = 0; i < num_subbands; ++i)
write_ready... | 6 |
public int connect(String hostname, int port) {
int i;
synchronized (servlist) {
for (i = 0; i < mclients; i++) {
if (servlist[i] == null)
break;
}
if (i >= mclients) {
// double the list if its too big...
ajserverthread newlist[] = new ajserverthread[2*mclients];
for (i = 0; i < mcl... | 5 |
public String type() {
final TinyELToken tok = lexer.token();
switch (tok) {
case BYTE:
case SHORT:
case INT:
case LONG:
case FLOAT:
case DOUBLE:
lexer.nextToken();
return tok.name;
defaul... | 6 |
@Override
public void update(GameContainer gc, int delta) throws SlickException {
switch (state) {
default:
case MENU:
menu.update(gc, delta);
case PAUSED:
break;
case PLAYING:
player.update(gc, delta);
break;
case QUIT:
gc.exit();
}
} | 4 |
private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... | 5 |
public boolean checkBoard() {
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
if(!checkCell(i, j)){
return false;
}
}
}
return true;
} | 3 |
void removeElement(Element element) {
if (element == null)
throw new IllegalArgumentException("Element can't be null!");
elements.remove(element);
} | 1 |
private void placeShips() {
ArrayList<Ship> shipsToPlace = new ArrayList<>();
shipsToPlace.add(new Ship(eShipType.aircraftcarrier));
shipsToPlace.add(new Ship(eShipType.battleship));
shipsToPlace.add(new Ship(eShipType.destroyer));
shipsToPlace.add(new Ship(eShipType.patrolboat))... | 3 |
@SuppressWarnings("unused")
private void create() { //créé un villageois
if (this.statue < 3){
if (this.stock >= 150){
this.statue++;
this.stock = this.stock-150;
if (this.statue == 3) {
this.al.caserne.remove(this.curent);
this.al.demande_ressource.add(this.curent);
}
}
}
e... | 4 |
public void updateSpreadsheetsList() {
URL metafeedUrl = null;
try {
metafeedUrl = new URL("https://spreadsheets.google.com/feeds/spreadsheets/private/full");
} catch (MalformedURLException e) {
guiRef.writeSysLog("E","The Google spreadsheets URL seems invalid. Nothing that you can do about it.");
e.prin... | 5 |
@Override
public Citation getCitation(Integer id) {
for (Citation c : citations) {
if (id.equals(c.getId())) {
return c;
}
}
throw new IllegalArgumentException("No citation with such id!");
} | 2 |
public static boolean arePointsOnSameSideOfLine(Point p1, Point p2, Point l1, Point l2) {
if (GeometryUtils.isLineHorizontal(l1, l2)) {
if (p1.y() < l1.y() && p2.y() < l1.y()) return true;
if (p1.y() > l1.y() && p2.y() > l1.y()) return true;
return false;
}
... | 9 |
private void showErrorMessage(Thread t, Throwable e) {
String s1 = null, s2 = null, s3 = "";
switch (errorType) {
case LOAD_ERROR:
String s = Modeler.getInternationalText("LoadingError");
s1 = s != null ? s : "Loading Error";
s = Modeler.getInternationalText("EncounteredErrorInLoadingDataCausedBy");
s... | 7 |
@Override
public boolean borrarElemento(Object n) {
if (this.esVacia())
return false;
if (this.inicio.getObj().equals(n)) {
this.borrarInicio();
return true;
} else {
NodoLista aux = this.inicio;
while (aux.getSig() != null && !aux.getSig().getObj().equals(n))
aux = aux.getSig();
// lo enco... | 5 |
final byte[] loadArchiveChild(int i, int i_5_, int[] is) {
anInt639++;
if (!isValidChild(i, i_5_))
return null;
if (childBuffers[i] == null || childBuffers[i][i_5_] == null) {
boolean bool = loadArchive(i, i_5_, is);
if (!bool) {
loadArchive(i);
bool = loadArchive(i, i_5_, is);
if (!bool)
... | 8 |
public void update(){
//Get number of frames that passed
double exactDF = Directory.spriteManager.getDeltaFrames();
if(exactDF >= 1){
int dF = 0;
dF = (int) Math.floor(exactDF);
Directory.spriteManager.flagDeltaFramesReset();
//If the current column is the last column
if(currentColumn == numCo... | 5 |
private void write(String user, String event, int glID, String resName,
String status, double clock)
{
if (trace_flag == false) {
return;
}
// Write into a results file
FileWriter fwriter = null;
try
{
fwriter = new FileW... | 4 |
public static boolean stringToBoolean(String bool) {
if(bool.equals("ON"))
return true;
else
return false;
} | 1 |
public static boolean isAfter(Date date1, Date date2) {
int[] dIng1 = getDateIngredients(date1);
int day1 = dIng1[0];
int month1 = dIng1[1];
int year1 = dIng1[2];
int[] dIng2 = getDateIngredients(date2);
int day2 = dIng2[0];
int month2 = dIng2[1];
int year2 = dIng2[2];
if (year1 > year2) {
return... | 9 |
public Object peek() {
return getFirst();
} | 0 |
public static void update() {
while (Keyboard.next()) {
int eventKey = Keyboard.getEventKey();
if (0 <= eventKey && eventKey < NUM_KEYCODES) {
lastKeys[eventKey] = Keyboard.getEventKeyState();
}
}
while (Mouse.next()) {
int eventButton = Mouse.getEventButton();
if (0 <= eventButton && eventB... | 6 |
WordNet(String sentiPath) {
System.out.println("Initializing Wordnet database...");
sentimentMap = new SentiMap();
// create BufferedReader
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(sentiPath));
} catch (FileNotFoundException e) {... | 5 |
protected int collapsesNeeded() {
State[] states = automaton.getStates();
int needed = 0;
for (int i = 0; i < states.length; i++)
for (int j = 0; j < states.length; j++)
if (automaton.getTransitionsFromStateToState(states[i],
states[j]).length > 1)
needed++;
return needed;
} | 3 |
public void run () {
try {
U.infoOut("Connection accepted: " + socket);
mConLineIn = new BufferedReader(new InputStreamReader(socket.getInputStream(), "UTF8"));
mConLineOut = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), "UTF8")), true);
socket.setSoTimeout(MAIN_SERVE... | 8 |
public static int possibleMoves (int x, int y) {
// bottom up approach
// initialize the table
int[][] s = new int[x+1][y+1];
// top row
for ( int i=0; i <= x; ++i )
s[i][0] = 1;
// left column
for ( int i=1; i <= y; ++i )
s[0][i] = 1;
// build up the table
for ( int i=1 ; i <= x; ++i ... | 4 |
@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
OrthographicCamera camera = WidgetMgr.MAP_EDITOR.camera;
if(Gdx.input.isButtonPressed(Input.Buttons.RIGHT)){
Ray pickRay = camera.getPickRay(Gdx.input.getX(), Gdx.input.getY());
I... | 4 |
private void openNothings()
{
int flags = 0;
final TileSet nothings = new TileSet(mField);
final int size = nothings.size();
for (int tile = 0; tile < size; tile++ )
{
final MaskValue mask = mField.getMaskValue(tile);
if (mask.isFlag()) flags++ ;
if (mask.isNothing()) nothings.add(tile);
}
if (m... | 5 |
@DELETE()
@Path("release/{playerId}")
@Produces("application/json")
@SportService(ServiceType.MLB)
public Player releasePlayer(@PathParam("playerId") int iPlayerId)
{
Player p = new Player();
UserTransaction utx = null;
try
{
... | 4 |
String getLoginType() {
if (userName.equals("admin")) {
return "admin";
} else if (userName.equals("User")) {
return "user";
} else if (userName.equals("lab")) {
return "lab";
} else if (userName.equals("medical")) {
return "medical";
}else if(userName.equals("counter")){
return "counter";
}e... | 7 |
private static String getAttributeValue(Node node, String attribname) {
final NamedNodeMap attributes = node.getAttributes();
String value = null;
if (attributes != null) {
Node attribute = attributes.getNamedItem(attribname);
if (attribute != null) {
valu... | 2 |
public static int findMaximumPathSum(){
String linestr;
String[] tokens;
int lines = 0, i = 0;
int j,temp;
try{
BufferedReader br = new BufferedReader(new FileReader("triangle"));
LineNumberReader reader = new LineNumberReader(new BufferedReader(new FileReader("triangle")));
while((reader.readLine(... | 8 |
private int parseSplit(char ch, int state) {
if (state == 0) {
switch (ch) {
case '\n': return 1;
case '\t': return 2;
case '\r': return 3;
case ' ': return 4;
case ';': return 5;
}
}
return -... | 6 |
@RequestMapping("/discountRead.do")
public ModelAndView discountShowInfo(Device device, HttpServletRequest req)
throws Exception {
ModelAndView mav = new ModelAndView();
// 공연 제목을 받아와 공연 제목의 해당하는 seq 값을 가져오기 위한 변수
String title = req.getParameter("title");
String mapPlace = req.getParameter("place");
// xm... | 5 |
void processaNada()
{
int vPresa, vPredador, vReciclador, vDefunto;
int i, j;
for(i = 0; i < l; i++)
for(j = 0; j < c; j++)
if(mapa_atual[i][j].tipo == NADA)
{
vPresa = ContaVizinhosR1(mapa_atual, PRESA, i, j);
vPredador = ContaVizinhosR1(mapa_atual, PREDADOR, i, j);
vReciclador = Cont... | 8 |
public HealthBar getHealthBarLength(HealthBar h8, int health, int maxHealth)
{
if (health < 0)
health = 0;
h8.percent = (double) health / (double) maxHealth;
double placeHolder = h8.percent * 144.0;
h8.length = (int) placeHolder;
if (h8.percent > .5)
h8 = HealthBar.GREEN;
else if (h8.percent > .2)
... | 3 |
public boolean isPalindrome1(String s) {
if (s == null || s.length() == 0 || s.trim().length() == 0) {
return true;
}
String newS = "";
for (char c : s.toLowerCase().toCharArray()) {
if (isCharNum(c)) {
newS += c;
}
}
fo... | 7 |
@Override
public boolean equals(Object object) {
if (object instanceof Rule) {
return (
this.ruleName.equals(((Rule)object).ruleName)
&& this.ruleURL.equals(((Rule)object).ruleURL)
&& this.ruleRegExpr.equals(((Rule)object).ruleRegExpr)
... | 3 |
@Override
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
/* Validate password. Make sure confirm password and password match */
String password = value.toString();
UIInput uiInputConfirmPassword = (UIInput) component.getAttributes().get... | 5 |
public Integer CheckHighestNumberOfTokenInLine(Position pos) {
Integer i = 0;
i = CheckVertical(pos);
if(CheckHorizontal(pos) > i){i = CheckHorizontal(pos);}
if(CheckMainDiagonal(pos) > i){i = CheckMainDiagonal(pos);}
if(CheckOffDiagonal(pos) > i){i = CheckOffDiagonal(pos);}
... | 3 |
public GekozenAntwoord(logic.GekozenAntwoord gk, ComboBoxModel comboBoxModel) {
gekozenAntwoord = gk;
File file = gk.getHuidigeOnderdeel().getPlaatje();
this.comboBoxModel = comboBoxModel;
try {
imagePanel = new ImagePanel(file);
imagePanel.setAutoResize(true);
imagePanel.setBorder(new EtchedBorder(Etc... | 1 |
private boolean readCrossrefStream(PDFObject xrefStream, boolean followPrev) throws IOException {
// the xref stream will have an object number but since there's no
// decryption involved, it doesn't matter
if (xrefStream == null) {
xrefStream = readObject(fileBuf, -1, -1, IdentityD... | 8 |
public void checkNeedMenu(JPanel panel, List<TabButton> tabs, TabButtonMenu menuTab){
boolean tabOutScreen = false;
int lastVisibleIndex = (getWidth()+TOTAL_BUTTON_WIDTH/2)/TOTAL_BUTTON_WIDTH - 1;
for(TabButton tab : tabs){
if(tab.data.index > lastVisibleIndex){
... | 5 |
public void run(CommandSender sender, String[] args) {
if(args.length == 0) {
sender.sendMessage(ChatColor.RED + "You didn't enter a user.");
return;
}
String p = args[0];
if(args.length < 2) {
if(SettingsManager.getInstance().getPermissions(p).size() == 0) {
sender.sendMessage(ChatColor.YELL... | 6 |
public static void main(String[] args){
// 输出重定向
BufferedOutputStream os = null;
PrintStream ps = null;
try {
os = new BufferedOutputStream(new FileOutputStream("result_other.txt"), 1024);
ps = new PrintStream(os, false);
System.setOut(ps);
} c... | 4 |
private void loadBlockData(String x, String y, String z, String wn) {
try {
blockX = (ArrayList<Integer>) load(this.blockFileX);
blockY = (ArrayList<Integer>) load(this.blockFileY);
blockZ = (ArrayList<Integer>) load(this.blockFileZ);
this.loadedWorld = wn;
... | 2 |
public int turnWeek(String week) {
int i;
for (i = 0; i < 7; i++)
if (week.equalsIgnoreCase(stringWeekEn[i]))
break;
return i;
} | 2 |
public void actionPerformed(ActionEvent ae)
{
//gets the password from the user
password = input.getText();
//call the strength check message
strengthCheck();
//display password strength
strength.setText("Password Strength: " + check);
//Change the color of the password strength based on s... | 8 |
public VueLecture() {
// setBorder(new TitledBorder("Lecture")); // Titre du panel
/* Background */
// setBackground(Color.white);
// setOpaque(false);
// redimensionner
// ImageIcon icon = new ImageIcon(new
// ImageIcon("img//gdeFond2.jpg").getImage().getScaledInstance(this.getHeight(),
// this.getWidt... | 0 |
public boolean readBoolean() throws IOException {
int code = readNextCode();
switch (code) {
case Codes.TRUE:
return true;
case Codes.FALSE:
return false;
default: {
Object result = read(code);
if (resul... | 3 |
@Override
public ArrayList<Excel> getColoredExes() {
// TODO Auto-generated method stub
return coloredEx;
} | 0 |
public Object pull() {
if(top>0) {
return stack.remove(top-1);
}
else
return 0;
} | 1 |
public boolean estReserve(){
if(this.situation == RESERVE){
return true ;
}
else {
return false ;
}
} | 1 |
public JSONObject increment(String key) throws JSONException {
Object value = this.opt(key);
if (value == null) {
this.put(key, 1);
} else if (value instanceof Integer) {
this.put(key, (Integer) value + 1);
} else if (value instanceof Long) {
this.put(... | 5 |
@Override
public Set<Data> check(Player player) {
Set<Data> data = new HashSet<Data>();
PreparedStatement ps = null;
try {
ps = this.db().prepareStatement("SELECT * FROM `gatekeeper_player` WHERE `player` = ?");
ps.setString(1, player.getName());
ps.execute();
ResultSet rs = ps.getResultSet();
wh... | 8 |
public long nextLong() throws IOException {
int p = peeked;
if (p == PEEKED_NONE) {
p = doPeek();
}
if (p == PEEKED_LONG) {
peeked = PEEKED_NONE;
return peekedLong;
}
if (p == PEEKED_NUMBER) {
peekedString = new String(buffer, pos, peekedNumberLength);
pos += peek... | 8 |
@Test
public void testAssignmentsConditions() throws ClassNotFoundException, NoSuchMethodException, SecurityException {
for(int i = 6; i <= 10; i++) {
for(int j = 1; j <= 7; j++ ) {
Class<?> assignment = AssesmentGetter.getAssignment(i, j);
assignment.getMethod("main", String[].class);
assignment.getM... | 3 |
public List findByMemoryLimit(Object memoryLimit) {
return findByProperty(MEMORY_LIMIT, memoryLimit);
} | 0 |
public void walk(){
if(xPos + direction[0] > 9 || xPos + direction[0] < 0 || yPos + direction[1] > 9 || yPos + direction[1] < 0){
xPos += direction[0];
yPos += direction[1];
}
if(ownGarden.isAppleOnField(xPos, yPos)){
ownGarden.removeApple(xPos, yPos);
appleCache++;
}
} | 5 |
public void close(){
if(this.requestWithFile != null && this.requestWithFile.isReadFile()){
FileTransfer fr = requestWithFile.getFileReceiver();
if(fr != null && !fr.finishWrite()){
fr.forceClose();// 强制关闭删除损害的文件
}
}
// 关闭连接
SocketChannel socketChannel = (SocketChannel) this.key.channel();
... | 6 |
public double getY() {
return y;
} | 0 |
public void attribute(String aname, String value, boolean isSpecified)
{
if (aname.equals("id") && currentModule == null)
id = value;
if (currentModule != null) {
asiModuleHandler.attribute(aname, value, isSpecified);
}
} | 3 |
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
AnnotationVisitor av;
av = super.visitAnnotation(remapper.mapDesc(desc), visible);
return av == null ? null : createRemappingAnnotationAdapter(av);
} | 1 |
public T next() {
try {
return type.newInstance();
} catch (Exception e) {
throw new RuntimeException();
}
} | 1 |
private void processDay(HSSFWorkbook workbook, Day day) {
System.out.println("Processing " + day);
block = null;
HSSFSheet sheet = workbook.getSheet(day.name());
int maxRows = sheet.getPhysicalNumberOfRows();
int rowIndex = 0;
HSSFRow row = sheet.getRow(rowIndex++);
workingDa... | 9 |
public void menuMain() throws MalformedURLException, InterruptedException, IOException {
Scanner in = new Scanner(System.in);
while (true) {
System.out.println("******************* Main Menu *************************");
System.out.println("* ... | 7 |
@Test
public void testGetBooks() {
Integer testISBN = 400;
Set<StockBook> booksToAdd = new HashSet<StockBook>();
booksToAdd.add(new ImmutableStockBook(testISBN, "Book Name",
"Book Author", (float) 100, 5, 0, 0, 0, false));
try {
storeManager.addBooks(booksToAdd);
} catch (BookStoreException e) {
e.... | 9 |
public int executeSQLUpdate(String sqlStatement) {
try {
// Datenbankverbindung herstellen
connect = connectDB();
// PreparedStatement für den SQL-Befehl
myPreparedStatement = connect.prepareStatement(sqlStatement);
// SQL-Befehl wird ausgeführt
successful = myPreparedStatement.executeUpdate(sqlS... | 1 |
protected void setDirection(int dir) {
if (dir == RIGHT) {
moveDirection = RIGHT;
checkDirection = UP;
}
else if (dir == DOWN) {
moveDirection = DOWN;
checkDirection = RIGHT;
}
else if (dir == LEFT) {
moveDirection = LEF... | 4 |
protected void handleControlPropertyChanged(final String PROPERTY) {
if ("RESIZE".equals(PROPERTY)) {
resize();
} else if ("DESIGN".equals(PROPERTY)) {
updateDesign();
} else if ("SECOND_POINTER_VISIBLE".equals(PROPERTY)) {
secondPointerGroup.setOpacity(getSki... | 8 |
public long get_field_as_milliseconds( String section, String field )
throws NoSuchKeyException, NoSuchSectionException, BadFormatException {
String s;
long i;
s = get_field( section, field );
try {
i = Long.parseLong( s );
}
catch( Exception ex ) {
try {
StringTokenizer tok = new StringTokenizer( s, ... | 4 |
@Override
public byte[] getPayload() throws IOException {
byte[] frameData = super.getPayload();
return Arrays.copyOfRange(frameData, this.picDataFrameOffset, frameData.length);
} | 0 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
BigInteger nine = new BigInteger("9");
BigInteger zero = BigInteger.ZERO;
while ((line = in.readLine()) != null && ... | 7 |
public void insertNonFull(int key, int value, BTreeNode startNode) {
int keyIndex = startNode.getNoOfKeys()-1;
if (startNode.isLeaf()) {
while( keyIndex >= 0 && key < startNode.getKeyAt(keyIndex)) {
startNode.setKeyAt(keyIndex+1, startNode.getKeyAt(keyIndex));
startNode.setValueAt(keyIndex+1, startNode.g... | 7 |
public static int[][] calcScoreMatrix(char[] st1, char[] st2) {
int[][] score = new int[st1.length+1][st2.length+1];
// расстояния между одной строкой и другой пустой
for (int i = 0; i <= st1.length; i++) {
score[i][0] = i;
}
for (int i = 0; i <= st2.length; i++) {
score[0][i] = i;
}
// заполним ма... | 5 |
public String getSelectedValue() {
String result = "";
for (ComboboxItem ci : comboItems) {
if (ci.isSelected()) {
result = ci.getValue();
}
}
return result;
} | 2 |
public static List<Variable> getVariablesFromFileObfuscationStructure (List<FileObfuscationStructure> fileInstances) {
List<Variable> result = new ArrayList<Variable>();
for (FileObfuscationStructure file : fileInstances) {
for (VariableAppearance appearance : file.getFileVariablesAppearances()) {
String nam... | 3 |
public static void main(String[] args) {
BurstBalloons burstBalloons = new BurstBalloons();
int[] test = {3, 1, 5, 8};
System.out.println(burstBalloons.maxCoins(test));
} | 0 |
@Test
public void resolve() {
int sum = 0;
for (int i = 1; i < 1000; i++) {
sum += getLetterCount(i);
}
sum += "onethousand".length();
print(sum);
} | 1 |
public Factory(int num) {
Resource res = Utils.myres(this.getClass());
this.neg = res.layer(Resource.negc);
this.num = num;
ArrayList<Tex> strands = new ArrayList<Tex>();
for(Resource.Image img : res.layers(Resource.imgc)) {
if(img.id != -1)
strands.add(img.tex());
}
this.stra... | 2 |
@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 ItemReturn)) {
return false;
}
ItemReturn other = (ItemReturn) object;
if ((this.itemReturnPK == null && other.... | 5 |
public void setEndStop(int value) {
this._endStop = value;
} | 0 |
public JSONArray toJSONArray(JSONArray names) throws JSONException {
if (names == null || names.length() == 0) {
return null;
}
JSONArray ja = new JSONArray();
for (int i = 0; i < names.length(); i += 1) {
ja.put(this.opt(names.getString(i)));
}
re... | 3 |
public Instruction[][] readProgram(InputStream is) throws IOException, ProgramReaderException {
List<String> lines = IOUtils.readLines(is, "UTF-8");
int numLines = lines.size();
int numColumns = 0;
// First pass : get the words
String[][] parsedLines = new String[numLines][];
for (int currentLineIndex = ... | 9 |
public static String getFirstColorCode(String minecraft){
String codes = "abcdef0123456789";
for(int i=0; i<minecraft.length(); i++){
if(minecraft.charAt(i) == '&'){
if(i == codes.length() - 1) return null;
if(minecraft.length() > 1 && i < minecraft.length() - 1 && codes.contains(minecraft.charAt(i + 1) ... | 6 |
public boolean collisionCheck(Level level, int currentRoom) {
Boolean returnBool = false;
List<Float> obsLocations = new ArrayList<Float>();
for (int i = 0; i < level.getRoomList().get(currentRoom).getObsList().size(); i++) {
obsLocations.add(level.getRoomList().get(currentRoom).getObsList().get(i).getPos().g... | 6 |
public String HapusHuruf(String strQty){
char [] data = TitikHanya2(strQty).toCharArray();
//char [] data = strQty.toCharArray();
String newStrQty = "";
for (char c : data){
if (Character.isDigit(c) || c == '.') {
newStrQty = newStrQty + String.valueOf(c);
... | 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.