text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static void loadFonts(){
try {
resource = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/fonts.png"));
} catch (IOException e) {
e.printStackTrace();
}
try {
texture = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/background/sand.png"));... | 2 |
public void applyPreserveRule(IdentifierMatcher preserveRule) {
if (loadOnDemand)
loadMatchingClasses(preserveRule);
super.applyPreserveRule(preserveRule);
} | 1 |
@Override
public void componentResized(ComponentEvent e) {
// 根据panel自适应大小,调整scrollpane和textArea的位置
scrollPane.setBounds(0, 0, this.getWidth(), this.getHeight());
textArea.setSize(scrollPane.getSize());
// 调整滚动条到随后
textArea.selectAll();
// 去掉全选效果
textArea.setCaretPosition(textArea.getDocument().getLengt... | 0 |
public LocalDate getEndDate() {
return this._endDate;
} | 0 |
@OneToMany(mappedBy="car")
public List<Participant> getPassengers() {
return passengers;
} | 0 |
void replaceAllocStmt(Unit u){//Set<Unit> set){
String classname = null;
/* Iterator it = u.getDefBoxes().iterator();
while(it.hasNext()){
Value v = ((ValueBox)it.next()).getValue();
if(v instanceof Local){
Local l = (Local)v ;
classname = l.getType().toString();
}
}
*/
StringBuilder sb = n... | 3 |
public void setPcaIdElemento(int pcaIdElemento) {
this.pcaIdElemento = pcaIdElemento;
} | 0 |
private static boolean doesPatternExist(Map<Byte, byte[]> haystack,
byte[] needle) {
if (needle == null)
return false;
for (Byte key : haystack.keySet()) {
if (Arrays.equals(haystack.get(key), needle)) {
return true;
... | 3 |
private void loadingStages()
{
if(lowMem && loadingStage == 2 && ObjectManager.anInt131 != plane)
{
aRSImageProducer_1165.initDrawingArea();
aTextDrawingArea_1271.drawText(0, "Loading - please wait.", 151, 257);
aTextDrawingArea_1271.drawText(0xffffff, "Loading - please wait.", 150, 256);
aRSImageProdu... | 8 |
@Override
public int worldAging(int age) {
//between 4000BC and 100BC
if(age < -100){
return age + 100;
}
//Around birth of Christ
else if(age == -100){
return age = -1;
}
else if(age == -1){
return age = 1;
}
else if(age == 1){
return age = 50;
}
//between 50 AD and 1750 AD
e... | 7 |
private void multiplyTempo() {
String txt = tempoField.getText();
if (txt != null) {
int num = 1;
try {
num = Integer.parseInt(txt);
} catch (NumberFormatException e) {
return;
}
if (num <= 1)
ret... | 5 |
public void verifyType(String inMsg, BufferedReader in) throws Exception{
String welcomeMsg = WELCOME_CONSTANT + "\n";
String[] splitter = inMsg.split(":");
if ((splitter[0] + ":").equals(FROM_CONSTANT )){
if (!splitter[1].isEmpty()){
String ipReceived = splitter[1];... | 4 |
@Override
public void greeting(Context ctx) {
System.out.println("Hello !! " + LoggerUtils.getSig());
ctx.setState(new ConcreteState_Night());
} | 0 |
public boolean deleteFile(String filename, int resID)
{
// check for errors first
if (resID == -1 || filename == null) {
return false;
}
Object[] packet = new Object[2];
packet[0] = filename;
packet[1] = myID_;
// send the event
super.sen... | 4 |
@SuppressWarnings("unchecked")
@Override
public String displayQuestionWithAnswer(int position, Object userAnswer) {
ArrayList<String> questionList = (ArrayList<String>) question;
String questionStr = questionList.get(0) + "_____________" + questionList.get(1);
ArrayList<String> answerList = (ArrayList<String>) ... | 4 |
public void setSaveEncoding(String saveEncoding) {
this.saveEncoding = saveEncoding;
} | 0 |
public static List<Flow> getFlows(String dpid) throws IOException,
JSONException {
List<Flow> flows = new ArrayList<Flow>();
// If JSONObject is not supplied, get it.
try {
obj = (JSONObject) Deserializer.readJsonObjectFromURL("http://" + IP
+ ":8080/wm/core/switch/" + dpid + "/flow/json").get(5... | 7 |
public static boolean getFileWithHttp(String address, String localFileName) {
OutputStream out = null;
URLConnection conn = null;
InputStream in = null;
try {
// create local folders
new File(localFileName).getParentFile().mkdirs();
// get file
URL url = new URL(address);
out = new Buffere... | 5 |
@Override
public void affectPhyStats(Physical affected, PhyStats affectableStats)
{
super.affectPhyStats(affected,affectableStats);
if(affected instanceof MOB)
{
affectableStats.setSensesMask(affectableStats.sensesMask()|PhyStats.CAN_SEE_HIDDEN);
if(ticksSinceLoss>30)
affectableStats.setDisposition(af... | 8 |
static protected void FillBuff() throws java.io.IOException
{
int i;
if (maxNextCharInd == 4096)
maxNextCharInd = nextCharInd = 0;
try {
if ((i = inputStream.read(nextCharBuf, maxNextCharInd,
4096 - maxNextCharInd)) == -1)
{
... | 4 |
public static boolean conflitoLinha(int posicaox, int posicaoy, int valorteste, Celula[][] sudoku){
int linhateste = posicaox;
for(int i=0;i<=8;i++){
if(i==posicaoy){
continue;
}
Celula celulatestar = sudoku[linhateste][i];
if(celulatestar.... | 3 |
@Test
public void shouldThrowErrorWhenFileSizeTooBig() throws IOException {
//given
File tmpFile = folder.newFile(FILENAME);
String filePathString = tmpFile.getAbsolutePath();
Path filePath = Paths.get(filePathString);
byte[] bytes = new byte[260000];
Files.write(file... | 1 |
public void setWrap(int a){
switch(a){
case 0: mainBrain.setXYwrap(false, false); break;
case 1: mainBrain.setXYwrap(true, false); break;
case 2: mainBrain.setXYwrap(false, true); break;
case 3: mainBrain.setXYwrap(true, true); break;
}
} | 4 |
public void run() {
while(true){
if(client.isConnected()){
while(!client.isGameStarted()) { //listens to server for the go signal
client.listenToServer();
}
//
// game components revealed
//
setButton.setVisible(true);
lblNumberOfCards.setVisible(true);
numberOfCardsInDeck.setV... | 7 |
public static void main(String[] args)
{
ArrayList arrayList1 = new ArrayList();
arrayList1.add("Hello");
arrayList1.add("world");
arrayList1.add("world");
arrayList1.add("welcome!");
String s1 = (String)arrayList1.get(0);
String s2 = (String)arrayList1.get(1);
String s3 = (String)... | 2 |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Map<String, String> fouten = new HashMap<>();
String gebruikersnaam = request.getParameter("gebruikersnaam");
String paswoord = request.getParameter("paswoord");
if (gebruikersnaam == null || g... | 8 |
protected FrameDecoder retrieveDecoder(Header header, Bitstream stream, int layer)
throws DecoderException
{
FrameDecoder decoder = null;
// REVIEW: allow channel output selection type
// (LEFT, RIGHT, BOTH, DOWNMIX)
switch (layer)
{
case 3:
if (l3decoder==null)
{
l3decoder = new LayerIIIDec... | 7 |
public static void setPixels(BufferedImage img,
int x, int y, int w, int h, int[] pixels) {
if (pixels == null || w == 0 || h == 0) {
return;
} else if (pixels.length < w * h) {
throw new IllegalArgumentException("pixels array must have a length" ... | 6 |
@Test
public void testNextInt() {
System.out.println("nextInt");
RandomInt instance = new RandomInt();
int expResult = 0;
int result = instance.nextInt(1);
assertEquals(expResult, result);
expResult = 0;
result = instance.nextInt(2);
... | 0 |
public void inicio(Local local) throws Exception
{
salvar = new JButton("Salvar");
id = new JTextInt(local.getId());
id.setEditable(false);
id.setEnabled(false);
cidade = new JTextField(local.getCidade() == null ? ""
: local.getCidade());
estado = new JTextField(local.getEstado() == null ? ""
: loc... | 3 |
public static void insertActionCom(String typelibelle) throws SQLException {
String query = "";
try {
query = "INSERT INTO ACTION_TYPE (TYP_LIB) VALUES (?); ";
PreparedStatement pStatement = ConnectionBDD.getInstance().getPreparedStatement(query);
pStatement.setStr... | 1 |
public void setjButtonPrec(JButton jButtonPrec) {
this.jButtonPrec = jButtonPrec;
} | 0 |
private static int trySwapTimes(int[] a, int times){
if(times == 0) return maxSum(a);
int max = Integer.MIN_VALUE;
for(int i=0;i<allSwaps.size();i++){
Point p = allSwaps.get(i);
swap(a, p.x, p.y);
allSwaps.remove(i);
max = Math.max(max, trySwapTimes(a, times-1));
allSwaps.add(i, p);
}
return ma... | 2 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Vector3d vector3d = (Vector3d) o;
if (x == vector3d.x &&
y == vector3d.y &&
z == vector3d.z) {
return true;... | 6 |
@Override
public String getText() {
String typed = super.getText();
return typed.equals(hint) ? "" : typed;
} | 1 |
public void setName(String name) {
this.name = name;
} | 0 |
public String getHostname() {
return _hostname;
} | 0 |
public static void parseQueryString(String queryString, Map<String, String> params)
{
if (queryString == null || params == null)
{
return;
}
if (queryString.length() > 0)
{
String token;
int offset;
StringTokenizer tokenizer = n... | 5 |
public int getFloorDistance() {
return floorDistance;
} | 0 |
public static void main(String[] args) {
int port = 4444; // default port
// Check for and parse command line arguments
Queue<String> arguments = new LinkedList<String>(Arrays.asList(args));
try {
while ( ! arguments.isEmpty()) {
String flag = arguments.remo... | 8 |
private void handleMouseInput() {
if (Mouse.getDX() != 0 || Mouse.getDY() != 0) {
if (isMouseOnSelection(SELECTION.YES)
&& !currentSelection.equals(SELECTION.YES)) {
Sounds.get().playCursor();
currentSelection = SELECTION.YES;
} else if (isMouseOnSelection(SELECTION.NO)
&& !currentSelection.eq... | 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 |
public Grid getGrid() {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: getGrid() BEGIN");
}
if (test || m_test) {
System.out.println("GameBoardGraphics :: getGrid() END");
}
return m_grid;
} | 4 |
public int size() {
if(empty){
return 0;
}else if(begin < end){
return end-begin;
}else if(begin > end){
return MAX-begin+end;
}else{
return MAX;
}
} | 3 |
private void loadLanguage() {
try {
BufferedReader reader = new BufferedReader(new FileReader(new File(GameApplication.getGameDir() + File.separator + "resources" + File.separator + "lang" + File.separator + langFileName + ".glf")));
String cur;
while ((cur = reader.readLine... | 6 |
public static int minCut(String s) {
boolean [][] isPal = new boolean[s.length()][s.length()];
int[][] cost = new int[s.length()][s.length()];
// for single letter palindromes
for( int i = 0; i< s.length(); i++) {
isPal[i][i] = true;
cost[i][i] = 0;
}
... | 8 |
public static void main(String[] args)
{
SequentialSearchST<String, Integer> st = new SequentialSearchST<String, Integer>();
for (int i = 0; !StdIn.isEmpty(); i++)
{
String key = StdIn.readString();
st.put(key, i);
}
// print keys
for (String s : st.keys())
StdOut.println(s + " " + st.get(s));
... | 4 |
private int validMove(int x, int y)
{
if ((x >= 0) && (x < 10) && (y >= 0) && (y < 10))
{
if (this.playerIntBoard[x][y] > -2)
return 1;
}
else if ((x < 0) || (x >= 10) || (y < 0) || (y >= 10)) {
return -5;
}
return this.playerIntBoard[x][y];
} | 9 |
public Map<String, TableDescription> getTablesInDataBaseDescription() {
Map<String, TableDescription> result = new HashMap<String, TableDescription>();
for (DataBase db : databases.values()) {
for (TableDescription td : db.getTablesDescriptions()) {
String tableName = td.get... | 3 |
public List<QcTestCase> getTestCases(List<Long> testcaseIds) throws Exception {
List<QcTestCase> testCases = new ArrayList<QcTestCase>();
for (Long testcaseId : testcaseIds) {
QcRequest qcRequest = new QcRequest(QcConstants.QC_ENDPOINT_URL + "/test-case/" + testcaseId);
try {
... | 3 |
@Override
public void update() {
super.update();
Projectile projectile = null;
ArrayList deadProjectiles = new ArrayList();
try {
for (String key : projectiles.keySet()) {
projectile = (Projectile) projectiles.get(key);
projectile.update(... | 5 |
@Override
public boolean keyUp(int keycode) {
switch (keycode) {
case Keys.UP:
moving.remove(Dir.North);
return true;
case Keys.DOWN:
moving.remove(Dir.South);
return true;
case Keys.RIGHT:
moving.remove(Dir.East);
return true;
case Keys.LEFT:
moving.remove(Dir.West);
return true;
c... | 8 |
void rehash() {
int oldCapacity = table.length;
Entry oldMap[] = table;
int i;
for (i = oldCapacity; --i >= 0;) {
Entry e, next, prev;
for (prev = null, e = oldMap[i]; e != null; e = next) {
next = e.next;
Object obj = e.ref.get()... | 9 |
public static Session fromNanoCookie(NanoHTTPD.CookieHandler cookie) {
return fromSessionId(cookie.read(COOKIE_KEY));
} | 0 |
private void RenderFrame() {
int i = 0;
glBegin(GL_LINES);
glColor3d(1, 1, 1);
boolean draw = true;
for(i = 0; i < 8; i++){
for (int j = 0; j < 8; j++){
for (int l=0; l<8; l+=2){
if((i == opposites[l] && j == opposites[l+1]) || i == getExcludedVertex() || j == getExcludedVertex()){
draw = f... | 9 |
public void moveBullets() {
for (int i=0; i<MAX_BULLETS; i++) {
if (bullets[i].getVisibility()) {
bullets[i].moveForward();
}
}
} | 2 |
public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
switch(key) {
case KeyEvent.VK_W:
p.setMoveUp(true);
break;
case KeyEvent.VK_S:
p.setMoveDown(true);
break;
case KeyEvent.VK_A:
p.setMoveLeft(true);
break;
case KeyEvent.VK_D:
p.setMoveRight(true);
b... | 4 |
public int getBytesDownloaded(){
int total = 0;
for(int i : pieces.keySet()){
Piece p = pieces.get(i);
if(p==null)
continue;
total += p.bytesCompleted();
}
return total;
} | 2 |
public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... | 7 |
private static void deleteCompetitor(Scanner scan){
//If there are some competitors in table.
while (!ds.getAllCompetitor().isEmpty()) {
//Display all competitor for conveniently picking a name.
ds.printCompetitors(ds.getAllCompetitor());
System.out.println("please input the name of competitor whom you wan... | 8 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
response.setContentType("text/html");
final int dID = Integer.parseInt(request.getParameter("dID"));
PrintWriter out = response.getWriter();
if (new Control(-1).startParsing(dID))
{
out.pr... | 1 |
public Integer getEmailsCount() {
return emails.size();
} | 0 |
public static String[] readMap(int stage){
String[] array = new String[Constant.MAP_Array_SIZE];
File file = new File("source/stages/stage" + stage + ".txt");
BufferedReader bur = null ;
try {
FileReader fr = new FileReader(file);
bur = new BufferedReader(fr);
String str = null;
int i = 0 ;
w... | 4 |
public void setSelectionPointer(String pointerName) {
this.pointer = new SelectionPointer(pointerName);
if(selection != -1) {
pointer.setPositionAt(get(selection));
}
} | 1 |
public void act(){
if (clicked){
if (counter >= 10){
counter = 0;
clicked = false;
}
else{
counter++;
this.setImage (bg[2]);
}
}
else if (selected){
selected = false;
... | 3 |
public void restoreTemporaryToCurrent() {
lineEnd.restoreTemporaryToCurrent();
saveEncoding.restoreTemporaryToCurrent();
saveFormat.restoreTemporaryToCurrent();
ownerName.restoreTemporaryToCurrent();
ownerEmail.restoreTemporaryToCurrent();
applyFontStyleForComments.restoreTemporaryToCurrent();
applyFontSt... | 0 |
void checkEndCode() {
if (endCode) {
throw new IllegalStateException(
"Cannot visit instructions after visitMaxs has been called.");
}
} | 1 |
public static void main(String[] args) {
/* wap to print following pattern
*
***
*****
*******
*****
***
*
*/
for(int i=0;i<=3;i++)
{
for(int j=3;j>=i;j--){
System.out.print(" ");
}
for(int j=i;j>... | 6 |
private static ResourceUserList createGridUser(GridletList list)
{
ResourceUserList userList = new ResourceUserList();
userList.add(0); // user ID starts from 0
userList.add(1);
userList.add(2);
int userSize = userList.size();
int gridletSize = list.size(... | 3 |
@Override
public String getUsername() throws RemoteException {
{
try {
String name = JOptionPane.showInputDialog(null, "Please, enter your nickname!");
if (name != null && name.trim().length() > 0) {
nickname = name;
return ... | 4 |
public static Hand TwoPair(Rank firstPairRank, Rank secondPairRank, Rank firstKicker) {
return new Hand(HandRank.TwoPair, null, firstPairRank, secondPairRank, firstKicker, Rank.Null, Rank.Null);
} | 0 |
public Behaviour jobFor(Actor actor) {
if ((! structure.intact()) || (! personnel.onShift(actor))) return null ;
final Choice choice = new Choice(actor) ;
final Delivery d = Deliveries.nextDeliveryFor(
actor, this, services(), 10, world
) ;
if (d != null && personnel.assignedTo(d) < 1) {
... | 6 |
public CRLGen() {
super();
try {
crlM=new CRLManager();
//Certificat à révoquer
} catch (InvalidKeyException e) {
// TODO Bloc catch généré automatiquement
e.printStackTrace();
} catch (KeyStoreException e) {
// TODO Bloc catch généré automatiquement
e.printStackTrace();
} catch ... | 8 |
public void update(GameContainer c, StateBasedGame s, int d) throws SlickException {
GameScreen.time += d;
if (c.getInput().isKeyPressed(Input.KEY_SPACE)){
s.enterState(1);
}
} | 1 |
private static Result toResult(Object xml) throws IOException {
if(xml==null)
throw new IllegalArgumentException("no XML is given");
if (xml instanceof String) {
try {
xml=new URI((String)xml);
} catch (URISyntaxException e) {
xml=new ... | 9 |
@Override
public PlayerAbilities swapAbilityScores(int strength, int intelligence, int wisdom, int dexterity,
int constitution, int charisma) {
List<Integer> scores = new ArrayList<Integer>();
scores.add(abilities.getStrength());
scores.add(abilities.getIntellige... | 6 |
@Override
public Dimension getMinimumSize(JComponent c) {
if ((JOptionPane) c == optionPane) {
Dimension ourMin = getMinimumOptionPaneSize();
LayoutManager lm = c.getLayout();
if (lm != null) {
Dimension lmSize = lm.minimumLayoutSize(c);
if (ourMin != null) {
return new Dimension(Math.max(lmSiz... | 3 |
@Override
public Move findBestMove(int[][] board) {
while(true) {
String s = in.next();
for (Move move : Move.ALL) {
if(move.arrow.equals(s)) {
int[][] newBoard = makeMove(board, move);
copyBoard(board, newBoard);
... | 3 |
public static void main(String[] args) throws Exception {
final Runner runner = new Runner();
Thread t1 = new Thread(new Runnable() {
public void run() {
try {
runner.firstThread();
} catch (InterruptedException ignored) {}
}
... | 2 |
@Override
public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
Contexto oContexto = (Contexto) request.getAttribute("contexto");
oContexto.setVista("jsp/entrada/form.jsp");
EntradaBean oEntradaBean;
EntradaDao oEntradaDao;
oEntrad... | 2 |
public String KonversiKwitansi (double doubleAngka){
String [] bil ={"","satu","dua","tiga","empat","lima","enam","tujuh","delapan","sembilan","sepuluh","sebelas"};
String x=" ";
int intAngka = (int) doubleAngka;
if (doubleAngka<12){
x = bil[intAngka] + " ";
} else i... | 8 |
* @return a bitset with all specified versions set
*/
public BitSet convertVersions( String spec )
{
BitSet set = new BitSet();
if ( spec.toLowerCase().equals("all") )
{
for ( int i=1;i<=versions.size();i++ )
set.set(i);
}
else
{
... | 5 |
public static void main (String args[]) throws Exception{
ConnectionFrames playerWindow = new ConnectionFrames();
playerWindow.run();
Ball ball = new Ball();
while(playerWindow.connectionType == null);
System.out.println(playerWindow.connectionType);
//ball.run();
... | 3 |
public void addComment(String value)
{
if (value != null) // we have something
{
String trimmed = value.trim() ;
if (trimmed.length() > 0)
{
if (trimmed.charAt(0) == '#' ) // comment sign
{
comment.add( value ) ;
after = 0 ;
return ;
}
... | 4 |
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 int getMachineIndexByName(String machineFileName){
ArrayList machines = getEnvironment().myObjects;
if(machines == null) return -1;
for(int k = 0; k < machines.size(); k++){
Object current = machines.get(k);
if(current instanceof Automaton){
... | 4 |
@Override
public Iterable<Token> determineMostLikelyTags(Iterable<Token> sentence) {
List<Map<String, Double>> matrix = new ArrayList<>();
Map<String, List<String>> paths = createPath();
Iterator<Token> tokenIter = sentence.iterator();
// initialize base cases (t == 0)
String firstToken = tokenIter.next()... | 8 |
private static int parseArgs(String[] args, HamaConfiguration conf,
BSPJob bsp) {
conf.set(inputMatrixAPathString, args[0]);
conf.setInt(inputMatrixARows, Integer.parseInt(args[1]));
conf.setInt(inputMatrixACols, Integer.parseInt(args[2]));
conf.set(inputMatrixBPathString, args[3]);
conf.setInt(inputMatrix... | 7 |
public static void createColumn(CyTable table, String columnName, Class type, Class elementType) {
CyColumn column = table.getColumn(columnName);
if (column != null) {
if (!column.getType().equals(type))
throw new RuntimeException("Column "+columnName+" already exists, but has a different type");
if (colu... | 5 |
@Override
public void action() {
//System.out.println("Executando comportamento esperarReputacao");
ACLMessage mensagem = this.agenteReputacao.receive();
if(mensagem != null){
System.out.println("Recebi Mensagem");
ACLMessage mensagemDeRetorno = mensagem.createReply();
AID agenteEmissorAid ... | 7 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Produk other = (Produk) obj;
if (!Objects.equals(this.Pcode, other.Pcode)) {
return false;
... | 3 |
protected void setupMouseControls(){
// right click to set the color
addMouseListener(new MouseInputAdapter() {
public void mouseClicked(MouseEvent e) {
if( e.getButton() == MouseEvent.BUTTON1 || e.getButton() == MouseEvent.BUTTON3){
int xPos = e.getX();
... | 8 |
public void insert(ListNode node, int index) {
ListNode currentNode = root;
ListNode beforeNode = root;
int currentIndex = 0;
if (!isEmpty() && index >= 0 && index <= size()) {
// iterate to index
while (currentNode != null && currentIndex != index) {
beforeNode = currentNode;
currentNode = curr... | 6 |
private String getCorrection(String word) {
String res = corrections.get(word);
if (res != null) {
return res;
}
for (String u : getMisspelled(word)) {
String s = corrections.get(u);
if (s != null && ((word.length() >= DOUBLE_CORRECTION_TRESHOLD) || i... | 5 |
public static void main(String[] args) throws Exception {
Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_40);
analyzer = new WhitespaceAnalyzer(Version.LUCENE_40);
String index_path = "D:/code_respo/index";
String data_path = "D:/code_respo/respo";
String query_path = "D:/code_respo/query.py";
Stri... | 7 |
@Override
public void tick() {
if (wait <= 3) {
wait++;
return;
}
if (getLevel().getTile(getX(), getY() - 1, getZ()).getVisableBlock() == 0)
move(getX(), getY() - 1, getZ());
} | 2 |
@Override
public void deleteEntity(T entity) throws DaoException {
waitCompete();
getEntities().remove(entity);
} | 0 |
public PodcastModel[] getSearchResult1(){
try{
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse(_url.openStream());
doc.getDocum... | 3 |
public byte[] toBytes() {
ByteBuffer buffer = ByteBuffer.allocate(BASE_SIZE + 4 + length);
buffer.putInt(length)
.put(Message.Type.PADDING.getTypeByte())
.put(data);
return buffer.array();
} | 0 |
public Problem validate(final Object instance,
final UpperCase annotation, final Object target,
final CharSequence value)
{
if (value == null || value.length() < 1)
{
if (annotation.required())
{
return new Problem(instance, annotation, target, value);
}
return null;
}
fo... | 5 |
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.