text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void ElaboraDate()
{
try {
System.out.println("crea");
PrintWriter writer = new PrintWriter(new FileWriter(heidelDate, false));
for (Document d : documents)
{
for (HeidelTerm ht : d.HeidelTerms)
{
if (ht.Tipo.equals("DATE"))
{
String term = ht.Termine;
... | 7 |
public Obuffer decodeFrame(Frame header, SoundStream stream)
throws DecoderException
{
if (!initialized)
{
initialize(header);
}
int layer = header.layer();
output.clear_buffer();
FrameDecoder decoder = retrieveDecoder(header, stream, layer);
decoder.decodeFrame();
output.write_bu... | 1 |
@Override
public void menu(User u) throws MenuExitException {
String menuString = "Configure Transport Action:\r\n";
menuString += "(01) Configure transport name \r\n";
menuString += "(02) Configure target room \r\n";
menuString += "(03) Configure prereq setting\r\n";
menuString += "(04) Configure range \r\n... | 9 |
private void loadFromFile(String fileName){
FileInputStream openFile;
ObjectInputStream ois;
try {
openFile = new FileInputStream(fileName);
setTitle("Pathfinder - " + fileName);
ois = new ObjectInputStream(openFile);
String bgImagePath = (String)o... | 6 |
private ArrayList<HashSet> ConstructSetOfSCC(FiniteStateAutomaton dfa){
/* initial state of dfa*/
State init = dfa.getInitialState();
ArrayList<HashSet> setOfScc = new ArrayList<HashSet>();
HashSet<State> scc = new HashSet<State>();
FSAConfiguration config = new FSAConfiguration(init,
null, nul... | 6 |
public void startWriting(String filename, int width, int widthC)
{
try
{
dos = new DataOutputStream(new BufferedOutputStream(
new FileOutputStream(filename)));
oneLineY = new byte[width];
oneLineCbCr = new byte[widthC];
}
catch (Exception e)
{
e.printStackTrace();
}
} | 1 |
public static void main (String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException cnfe) {
System.out.println(cnfe);
} catch (InstantiationException ie) {
System.out.println(ie);
} catch... | 6 |
public JSONObject increment(String key) throws JSONException {
Object value = opt(key);
if (value == null) {
put(key, 1);
} else if (value instanceof Integer) {
put(key, ((Integer)value).intValue() + 1);
} else if (value instanceof Long) {
put(key, ((L... | 5 |
private void onClick(){
String outDate;
int timeLimit = 0;
// Must check out at least one book
if (callNumbers.size() == 0) {
popMsg("Need to enter some books!");
return;
}
try {
timeLimit = LibraryDB.getManager().getTimeLimit(bid);
} catch (SQLException e) {
System.out.println(e.getMess... | 6 |
public void continueAfterBluffCall(boolean bluffCalled, PlayerWithChoices bluffCaller) {
if(bluffCalled){
playerUI.closeAllOtherPopups();
//TODO let player choose to not show they have the card
if(player.has(action.cardTypeRequired())){
playerUI.replaceCard(action.cardTypeRequired());
//Need special ... | 8 |
public static boolean isValidEmail(String email) {
if (email == null) return false;
return email.matches("[\\w-_.]+@[\\w-.]+\\.[a-zA-Z]{2,4}")
&& email.length() <= 100;
} | 2 |
public boolean addUserIntoQueue(User user, Playmode playmode){
boolean playmodeExists = gameQueueMap.get(playmode.getPmID()) != null;
if(playmodeExists){
Queue<User> gameQueue = gameQueueMap.get(playmode.getPmID());
gameQueue.add(user);
int requiredPlayer = playmode.getNeededPlayerCount();
if(gameQueue... | 3 |
public void addNewPiece() {
count++;
score++;
if (testMode && count == TEST_LIMIT+1) {
stopGame();
return;
}
// commit things the way they are
board.commit();
currentPiece = null;
Piece piece = pickNextPiece();
// Center it up at the top
int px = (board.getWidth() - piece.getWidth())... | 3 |
@Test
public void isDeserializedCorrectly() throws IOException {
SubscribeMessage msg = new SubscribeMessage("/test/topic/1",
QoS.AT_LEAST_ONCE);
msg.addTopic("/test/topic/2", QoS.AT_MOST_ONCE);
byte[] data = msg.toBytes();
MessageInputStream in = new MessageInputStream(
new ByteArrayInputStream(data))... | 1 |
private ArrayList<Square> createRow(String line)
{
// Initialize the row
ArrayList<Square> row = new ArrayList<Square>();
for(int x = 0; x < line.length(); x++)
{
// For each character in the string, create a Square
String s = line.substring(x,x+1);
Square newSquare = new Square(0);
boolean squareS... | 7 |
public DotExpression(ColorMapper colorMapper, String html, int defaultFontSize, HtmlColor color, String fontFamily,
int style, FileFormat fileFormat) {
if (html.contains("\n")) {
throw new IllegalArgumentException(html);
}
this.colorMapper = colorMapper;
this.fontFamily = fontFamily;
this.normalFont = n... | 8 |
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException
{
if (file.toString().endsWith(".zip") || file.toString().endsWith(".jar"))
{
final File dir = new File(Vars.HOME_DIR + "natives/" + file.getFileName().toString().replaceAll(".zip", "").replaceAll(".jar", ""));
... | 6 |
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attr) {
if (!file.toString().contains(
"dynmap" + System.getProperty("file.separator") + "web")) {// Comment out this if to allow copying of files in a folder called dynmap\web
try {
String sFile = file.toString();
copyToNew = ... | 2 |
public void deleteNote() {
int id_noteTmp = -1;
System.out.println("ID :");
id_noteTmp = Integer.parseInt(sc.nextLine());
NoteDB.setConnection(con);
NoteDB note = null;
note = new NoteDB(id_noteTmp);
try {
note.read();
} catch (Exception ex) {
... | 8 |
public final void update() {
chunkUpdates++;
int sx = x;
int sy = y;
int sz = z;
int ex = x + chunkSize;
int ey = y + chunkSize;
int ez = z + chunkSize;
int renderPassType;
for (renderPassType = 0; renderPassType < 2; ++renderPassType) {
... | 9 |
public char[] getCurrentIdentifierSource() {
//return the token REAL source (aka unicodes are precomputed)
//START EBAY MOD
if(m_enableFakeIdentifier){
return m_fakeIdentifierProvider.getTokenSource();
}
//END EBAY MOD
char[] result;
if (this.withoutUnicodePtr != 0) {
//0 is used as a fast test flag so the r... | 9 |
private void authenticate()
{
boolean isValid = false;
String username = "";
while (!isValid) {
synchronized (currentUser.getUsers()) {
try {
msg = (Message)inFromClient.readObject();
username = msg.getMessage();
if (!msg.getType().equals("login")) {
... | 5 |
public String terbilang(String nilai){
String temp="";
String temp2="";
int hasilBagi,sisaBagi;
int batas=3;//batas untuk ribuan
int maxBagian = 5;/*untuk menentukan ukuran array, jumlahnya sesuaikan dengan jumlah anggota dari array gradeNilai[] */
... | 4 |
public String sortingMethod(String[] stringList) {
String[] lexi = new String[stringList.length];
System.arraycopy(stringList, 0, lexi, 0, stringList.length);
Arrays.sort(lexi);
int[] original = new int[stringList.length];
int[] lengths = new int[stringList.length];
for (int i = 0; i < lengths.length; i++... | 9 |
private void clearNode(TrinaryTreeNode<T> node)
{
TrinaryTreeNode<T> parentNode = node.getParentNode();
TrinaryTreeNode<T> leftNode = node.getLeft();
TrinaryTreeNode<T> centerNode = node.getMiddle();
TrinaryTreeNode<T> rightNode = node.getRight();
// clear this node from the parent node
if (parent... | 5 |
private int get_prev_page(Page page) throws JOrbisException {
long begin=offset; //!!!
int ret;
int offst=-1;
while(offst==-1){
begin-=CHUNKSIZE;
if(begin<0)
begin=0;
seek_helper(begin);
while(offset<begin+CHUNKSIZE){
ret=get_next_page(page, begin+CHUNKSIZE-offset);
if(... | 7 |
public List<String> alloc(String filename, int num_chunks) {
int chunkloc = 1;
String chunk_uuid;
List<String> chunk_uuids = new ArrayList<String>();
for (int i = 0; i < num_chunks; i++) {
chunk_uuid = UUID.randomUUID().toString();
chunk_uuids.add(chunk_uuid);
chunktable.put(chunk_uuid, chunkloc);
c... | 3 |
@Delete
public void deletelo(Intervention ivt) {
String id = (String) getRequest().getAttributes().get("id");
String ivid = (String) getRequest().getAttributes().get("ivid");
System.out.println("id: " + id);
System.out.println("ivid: " + ivid);
System.out.println("Remark: " + ivt.getRemark());
System.out.p... | 3 |
public Node getNode() {return this.hoistedNode;} | 0 |
public void body()
{
initializeResultsFile();
createGridlet(super.get_id(), NUM_GRIDLETS);
// schedule the initial sending of gridlets in the future
// NOTE: if you have many resources and GIS entities, please make sure
// you wait for few minutes to allow GIS to receive reg... | 4 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Position))
return false;
Position other = (Position) obj;
if (facingPosition != other.facingPosition)
return false;
if (xCoord != other.xCoord)
return false;
if (... | 6 |
public void addVertex(Vertex v) {
DoublyLinkedList<Vertex> neighbours = new DoublyLinkedList();
neighbours.insertLast(v);
this.adjacencyList.insert(neighbours);
} | 0 |
public static HandshakeBuilder translateHandshakeHttp(byte[] buffer,
int readcount) throws Exception {
HandshakedataImpl1 draft = new HandshakedataImpl1();
ByteBuffer message = ByteBuffer.allocate(readcount);
message.put(buffer, 0, readcount);
byte[] lines = message.array();
int previndex = 0;
int index... | 4 |
public void draw(Transform transform) {
texture.bind();
updateTextureOffsets(transform);
GL11.glPushMatrix();
GL11.glTranslated(transform.x, transform.y, 0f);
GL11.glScalef(transform.scaleX, transform.scaleY, 0f);
if(transform.flipX) {
GL11.glRotatef(180f, 0, 1, 0);
}
if(transform.centerRot... | 6 |
@Override
public void paint(Graphics graphics) {
_image=_listener.getImage();
if(_image == null){ System.out.println("Houston, we have a problem..."); }
super.paint(graphics);
Dimension sz=getSize();
drawX = 0;
drawY = 0;
drawWidth = sz.width;
drawHeight = sz.height;
// Scale ... | 7 |
private boolean isColour()
{
ArrayList<Card> handCopy = (ArrayList<Card>) cards.clone();
boolean sameSuits = true;
Card first = handCopy.remove(0);
for (Card card : handCopy)
{
if ( !card.suit.equals(first.suit))
{
sameSuits = false;
... | 2 |
public static void testArrays(){
// arrays
// Note: c++ style double var[] does work, but is not preferred
// double[12] does not work, need a new statement
//double[] array = new double[5];
double[] array={8,3,6,2,1};
double total=0;
// for each style statement (... | 4 |
public Integer getNumber() {
return number;
} | 0 |
public void writeToFile() {
betterMap();
if (!(sortedFile.equals("")|| sortedFile == null)) {
try {
FileWriter fstream = new FileWriter(sortedFile);
BufferedWriter writer = new BufferedWriter(fstream);
for (String s : classSortedMap.keySet()) {
build = new RaceClassBuilder(maxNbrOfLaps, raceTime... | 5 |
private Type getType(String name) throws BadBytecode {
try {
return Type.get(classPool.get(name));
} catch (NotFoundException e) {
throw new BadBytecode("Could not find class [pos = " + lastPos + "]: " + name);
}
} | 1 |
private void sendToClientFile(IoSession session, String fileName)
throws IOException {
InputStream openStream = null;
try {
URL resource = this.getClass().getClassLoader()
.getResource("flume.properties");
openStream = resource.openStream();
Properties properties = new Properties();
properties.l... | 8 |
public static void main(String[] args) throws InterruptedException {
if (args.length != 2) {
printUsage();
System.exit(1);
} else {
if (args[0] != null && args[0].length() > 0) {
String filename = args[0];
Properties properties = loadPr... | 9 |
public static long playerNameToInt64(String s) {
long l = 0L;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
l *= 37L;
if (c >= 'A' && c <= 'Z')
l += (1 + c) - 65;
else if (c >= 'a' && c <= 'z')
l += (1 + c) - 97;
else if (c >= '0' && c <= '9')
l += (27 + c) - 48;
}
whil... | 9 |
private static String getExtension(String filename) {
int index = filename.lastIndexOf(Preferences.EXTENSION_SEPARATOR);
if (index == -1) {
return null;
} else {
return filename.substring(index + 1, filename.length());
}
} | 1 |
public boolean isEmpty(){
if(root == null)
return true;
return false;
} | 1 |
@Override
public void actionPerformed(ActionEvent e)
{
Object parent = e.getSource();
if (parent instanceof JButton)
{
JButton button = (JButton) parent;
String name = button.getText();
if (name.equals ("New Game"))
gui.reset();
else if (name.equals("Pause"))
Stats... | 7 |
private void createNpcs(){
HashSet<String> npcPaths;
try {
npcPaths = KvReader.getKvFiles("./npcs");
} catch (IOException e){
e.printStackTrace(System.err);
return;
}
for(String s : npcPaths){
HashMap<String, String> npcAttributes =... | 2 |
public void accioBotoAccepta()
{
try
{
String contrasenya_nova_introduida = new String( contrasenya_nova.getPassword() );
if ( !contrasenya_nova_introduida.equals( new String( confirma_contrasenya_nova.getPassword() ) ) )
{
VistaDialeg dialeg = new VistaDialeg();
String[] botons = { "Accepta" };
... | 4 |
private void updateFile(Vector stuList) {
//for some reason FileInputStream won't recognize a file unless the explicit file path is included
//is there a way to remedy this? EasyReader doesn't require this extra info
File file = new File(
"/Users/Shelley/Documents/DiningHallSeating/DHS/DiningHallSeating/Data/... | 4 |
public static int requestBuy(Player theCustomer,Field field) {
Object[] options = new Object[2];
options[0] = "Køb stedet";
options[1] = "Køb ikke";
String name="";
String type="";
int price=0;
int ftype=-1;
Brewery b = null;
ShippingLines sh = nul... | 7 |
public boolean isValidLocation(Location loc) {
return (loc.getX() >= 0 && loc.getX() <= getWidth()
&& loc.getY() >= 0 && loc.getY() <= getHeight());
} | 3 |
public static WaveReward[] loadWaveRewards(String xmlFilePath){
HashMap<HeroType, HeroData> statsMap = new HashMap<>();
NodeList rewardElements = getElements(xmlFilePath, "wave");
List<WaveReward> waveRewards = new ArrayList<>();
for(int i = 0; i < rewardElements.getLength(); i++){
WaveReward reward = new Wa... | 8 |
public static int GCD(int x, int y){
if (x == 0)
return y;
else if (y == 0)
return x;
else if (!isOdd(x) && !isOdd(y)){
x >>= 1;
y >>= 1;
return GCD(x, y) << 1;
} else if (!isOdd(x) && isOdd(y)){
return GCD(x >> 1, y);
} else if (isOdd(x) && !isOdd(y)){
retu... | 9 |
public Number getKey() {
if (this.keyList.size() == 0) {
return null;
}
if (this.keyList.size() > 1 || this.keyList.get(0).size() > 1) {
throw new RetrievalIdException("getKey方法只适用于单个主键的表结构,但当前表结构包含多个主键: " + this.keyList);
}
Iterator<Object> keyIterator = this.keyList.get(0).values().iterator();
if (k... | 6 |
public static boolean isApplicable(Object object) {
return object instanceof Automaton;
} | 0 |
public void quickSort(int[] array, int low, int high) {
if (array == null || array.length == 0) {
return;
}
if (high <= low) {
return;
}
//pick the pivot
int middle = low + (high - low) / 2;
int pivot = array[middle];
int i... | 9 |
public synchronized void init() {
if (inited) {
return;
}
Object parentTree = library.getObject(entries, "Parent");
if (parentTree instanceof PageTree) {
parent = (PageTree) library.getObject(entries, "Parent");
}
kidsCount = library.getNumber(entr... | 5 |
public final synchronized char readChar(){
inputType = true;
charType = true;
String word="";
char ch=' ';
if(!this.testFullLine) this.enterLine();
word = nextWord();
if(word.length()!=1)throw new IllegalArg... | 3 |
public void removeComponent(Component component){
components.remove(component);
if(Renderable.class.isInstance(component)){
renderers.remove((Renderable)component);
}
if(Updatable.class.isInstance(component)){
updaters.remove((Updatable)component);
}
} | 2 |
private static void displayRegistration(BufferedReader reader, VideoStore videoStore) {
try {
String username = "";
String password = "";
String name;
String creditCard;
String address;
String phone;
while (username.isEmpty()) {... | 4 |
@Override
public void destroy() {
super.destroy();
parent = null;
} | 0 |
private static Path processPoly(Element element, StringTokenizer tokens) throws ParsingException {
int count = 0;
ArrayList pts = new ArrayList();
boolean moved = false;
boolean reasonToBePath = false;
Path path = null;
while (tokens.hasMoreTokens()) {
try {... | 8 |
public void syncWithGraphics(){
int newRoundTime = graphicsContainer.get().thinktime;
if(newRoundTime != roundTimeMilliseconds){
roundTimeMilliseconds = newRoundTime;
Debug.info("Delay changed to " + newRoundTime);
Debug.guiMessage("Delay changed to " + newRoundTime);
}
} | 1 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Marca other = (Marca) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
ret... | 6 |
public static boolean doEntitiesCollide(Entity e1, Entity e2) {
if (e1 == null || e2 == null || e1 instanceof EntityParticle
|| e2 instanceof EntityParticle) {
return false;
}
Area a1 = new Area();
for (int i = 0; i < Render.renderers[e1.getRenderId()].shapes.size(); i++) {
a1.add(new Area(Render.ren... | 6 |
private static void SimpleBoolIf(Boolean b) {
if (b)
System.out.println("Item is true");
else if (!b)
System.out.println("Item is false");
} | 2 |
public void testRemoveIntervalConverterSecurity() {
if (OLD_JDK) {
return;
}
try {
Policy.setPolicy(RESTRICT);
System.setSecurityManager(new SecurityManager());
ConverterManager.getInstance().removeIntervalConverter(StringConverter.INSTANCE);
... | 2 |
public static void deleteQuizTakenHistory(Quiz quiz) {
try {
String statement = new String("DELETE FROM " + DBTable + " WHERE qid=?");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, quiz.quizID);
stmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace... | 1 |
protected static Ptg calcDCount( Ptg[] operands )
{
if( operands.length != 3 )
{
return new PtgErr( PtgErr.ERROR_NA );
}
DB db = getDb( operands[0] );
Criteria crit = getCriteria( operands[2] );
if( (db == null) || (crit == null) )
{
return new PtgErr( PtgErr.ERROR_NUM );
}
int fNum = db.findC... | 8 |
private void updateCurSpot (final char[][] newMap,
final boolean[][] newIsFalling, final Point pos) {
final char curSpot = getNewSpot(pos, DIRECT_NONE);
if (curSpot == ROCK) {
final Point newPosOfRock = new Point(pos);
boolean isRockMoved = true;
if (fallD... | 8 |
public void run() {
System.out.println("ApiRequestor " + name + " starting.");
try {
for (int i = 0; i < repeatCount; i++) {
final String testPhrase = name + "-" + Integer.toString(i + 1);
final String script = (name.equals("Long"))
? "(catch-task-processor-ter... | 5 |
public void enemySpawner() {
if(spawnFrame >= spawnTime) {
outerLoop: //Label so we can break from both loops.
for (int i = 0; i < levelEnemyList.size(); i++) {
for (int j = 0; j < levelEnemyList.get(i).length; j++) {
if(!levelEnemyList.get(i)[j].inGame && !levelEnemyList.get(i)[j].isDea... | 9 |
protected Venue() {
super(Venue.class.getSimpleName());
} | 0 |
private void getImage(JPanel panel, Class figure) {
if (figure==Oval.class) {
try {
JLabel label = new JLabel(new ImageIcon(ImageIO.read(ClassLoader.getSystemResource("oval.jpg"))));
panel.add(label);
} catch (IOException | IllegalArgumentException e) {
... | 7 |
private void importSpritePlacements(File f) {
InputStream input;
try {
input = new FileInputStream(f);
Yaml yaml = new Yaml();
Map<Integer, Map<Integer, List<Map<String, Integer>>>> spritesMap = (Map<Integer, Map<Integer, List<Map<String, Integer>>>>) yaml
.load(input);
int y, x;
ArrayLi... | 5 |
public Integer getQuantita() {
return quantita;
} | 0 |
private void quickSortList(int low, int high)
{
int i = low, j = high;
int temp;
int pivot = numList.get(low + (high - low) / 2);
while (i <= j)
{
while (numList.get(i) < pivot)
i++;
while (numList.get(j) > pivot)
j--;
... | 6 |
public static String[] getRemoveFileNames(String version) throws IOException {
String s = OberienURL.get(version);
String[] fileNames = s.substring(s.indexOf("[remove]")+7, s.indexOf("[/remove]")).split("\n");
for (int i = 0; i < fileNames.length; i++) {
fileNames[i] = "Game/" + fileNames[i];
}
return file... | 1 |
public ArrayList<LanguageId> getListOfLanguagesAsId() {
ArrayList<LanguageId> languagesList = new ArrayList<LanguageId>();
Set<String> supportedLanguagesKeys = supportedLanguages.keySet();
Iterator<String> iter = supportedLanguagesKeys.iterator();
String key;
while(iter.hasNext()) {
key = iter.next();
l... | 1 |
public static double gamma(double x) {
double xcopy = x;
double first = x + lgfGamma + 0.5;
double second = lgfCoeff[0];
double fg = 0.0D;
if (x >= 0.0) {
first = Math.pow(first, x + 0.5) * Math.exp(-first);
for (int i = 1; i <= lgfN; i++)
second += lgfCoeff[i] / ++xcopy;
fg = first * Math.sqrt... | 2 |
@Test
public void combine_shouldReturnEmptyList_whenSpecifiedLengthOutOfRange() {
String word = "abcd";
assertEquals("[]", combination.combine(word, 0).toString());
assertEquals("[]", combination.combine(word, 5).toString());
} | 0 |
@Basic
@Column(name = "cantidad")
public int getCantidad() {
return cantidad;
} | 0 |
public void readBoards() {
availableBoards.clear();
String s = props.getProperty("mosquito.board.dir");
if (s == null) {
log.error("No board directory specified in conf file.");
}
File dir = new File(s);
if (!dir.isDirectory()) {
log.error("Board directory is invalid " + s);
return;
}
File[] ... | 4 |
static double calculateScore(ArrayList<seed> seedlist, double s) {
double total = 0;
for (int i = 0; i < seedlist.size(); i++) {
double score;
double chance = 0.0;
double totaldis = 0.0;
double difdis = 0.0;
for (int j = 0; j < seedlist.size(); j++) {
if (j != i) {
totaldis = totaldis
... | 9 |
public Path getImgPath_SliderMidBtn(Imagetype type) {
Path ret = null;
switch (type) {
case DEFAULT:
ret = this.imgSliderMidBtn_Def;
break;
case FOCUS:
ret = this.imgSliderMidBtn_Foc;
break;
case PRESS... | 3 |
public void setAcknowledgement(Hashtable <String, Integer> Rpg){
for(String key : Rpg.keySet()){
this.acknowledgement.put(key, Rpg.get(key));
}
} | 1 |
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
// game loop
while (true) {
int SX = in.nextInt();
int SY = in.nextInt();
in.nextLine();
Integer max = null;
Integer maxPosition = null;
for (i... | 5 |
public void helper(int[] map, int nthQueen, ArrayList<String[]> result) {
int N = map.length;
if(nthQueen == N){
String[] temp = new String[N];
for(int k = 0; k < N; ++k){
temp[k] = "";
for(int m = 0; m < N; ++m){
if(m == map[k])
temp[k] += "Q";
else {
temp[k] += ".";
}
... | 8 |
public char[] readInNeighbors(char[] neighbors, int row, int column){
if(row-1 >= 0){
neighbors[0] = this.grid[row-1][column];
}
if(row-2 >= 0){
neighbors[1] = this.grid[row-2][column];
}
if(row+1 < this.gridSize){
neighbors[2] = this.grid[row+1][column];
}
if(row+2 < this.gridSize){
neighbors... | 8 |
public static String deleteAny(String inString, String charsToDelete) {
if (!hasLength(inString) || !hasLength(charsToDelete)) {
return inString;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < inString.length(); i++) {
char c = inString.charAt(i);
if (charsToDelete.indexOf(c) == -1) {
... | 4 |
public static void main(String[] args) {
ClassLoader cl = ClassLoader.getSystemClassLoader();
URL[] urls = ((URLClassLoader)cl).getURLs();
for(URL url: urls){
System.out.println(url.getFile());
}
try {
// System.setProperty("java.rmi.server.hostname", "24.86.28.122");
Sy... | 2 |
public boolean isReleased() {
if(isDisabled())
return false;
return released;
} | 1 |
public void show() {
for (int i = 0; i < a.length; i++)
System.out.print(a[i] + " ");
System.out.println();
} | 1 |
public boolean equals(Object o) {
if (o instanceof RangeType) {
RangeType type = (RangeType) o;
return topType.equals(type.topType)
&& bottomType.equals(type.bottomType);
}
return false;
} | 2 |
private void sleep(int t) {
int end = (int) (System.currentTimeMillis() + t);
while (System.currentTimeMillis() < end) {
try {
Thread.sleep(t);
} catch (InterruptedException e) {
e.getStackTrace();
}
}
} | 2 |
public String getName() {
return name;
} | 0 |
public Node get(long key) {
Node previous = cache[(int) (key & size - 1)];
for (Node next = previous.next; next != previous; next = next.next) {
if (next.hash == key) {
return next;
}
}
return null;
} | 2 |
public static Integer stringToIP(String text){
String[] bytes = text.trim().split("\\.");
if(bytes.length != 4)
return null;
try {
int ip = 0;
for(int i=0; i<4; i++){
int b = Integer.parseInt(bytes[i].trim());
ip |= b << (24 - 8*i);
}
return ip;
} catch (NumberFormatException e) {
... | 3 |
private void initialize() {
this.setBounds(100, 100, 800, 600);
sourceImagePanel = new JPanel();
sourceImagePanel.setBounds(10, 30, 293, 447);
getContentPane().add(sourceImagePanel);
imageSourceLabel = new JLabel("");
sourceImagePanel.add(imageSourceLabel);
imageSourceLabel.setIcon(new ImageIcon(IMAGE_S... | 1 |
public static int deltaBetweenSequenceNumbers(int earlierSequenceNumber, int laterSequenceNumber) {
int delta = laterSequenceNumber - earlierSequenceNumber;
if(delta < (Packet.MINIMUM_SEQUENCE_NUMBER - Packet.MAXIMUM_SEQUENCE_NUMBER)/2)
delta += Packet.MAXIMUM_SEQUENCE_NUMBER - Packet.MINIMUM_SEQUENCE_NUMBER + 1... | 2 |
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.