text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void populateTab_fleets(StarSystem system) {
// own fleets
for (Fleet f : system.getFleets()) {
if (f.getUser().equals(Client.getInstance().getLocalUser())) {
BottomMenuToolbarIcon fleetButton = new BottomMenuFleetIcon(f, false);
registerAction(fleetBu... | 8 |
@Override
public boolean doAction(String choice) {
switch (choice) {
case "M": // move to new location
this.displayMap();
LocationView locationView = new LocationView();
locationView.display();
break;
... | 9 |
@Test
public void runTestObjectSensitivity2() throws IOException {
InfoflowResults res = analyzeAPKFile("FieldAndObjectSensitivity_ObjectSensitivity2.apk");
if (res != null)
Assert.assertEquals(0, res.size());
} | 1 |
protected void wolfKill() {
Vector<Integer> targets = wolfVictim2.getTarget();
if (targets.size() == 0) {
bot.sendMessage(gameChan, getFromFile("NO-KILL", NARRATION));
return;
}
int target;
if (targets.size() == 1) {
target = targets.get(0);
} else {
target = targets.get((int) Math.random() * ta... | 3 |
@Override
public WebDriver getWebDriver()
{
System.setProperty("webdriver.ie.driver","src/test/resources/IEDriverServer");
return new InternetExplorerDriver();
} | 0 |
private void buildSummary(MemberSummaryWriter writer,
VisibleMemberMap visibleMemberMap, LinkedList<Content> summaryTreeList) {
List<ProgramElementDoc> members = new ArrayList<ProgramElementDoc>(visibleMemberMap.getLeafClassMembers(
configuration));
if (members.size() > 0) {
... | 7 |
public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... | 7 |
private boolean validar(String hora) {
boolean res = true;
int h = 0;
int m = 0;
if (!"".equals(hora)) {
String[] temp = hora.split(":");
if (temp.length < 2) {
res = false;
}
try {
h = Integer.parseInt(temp[... | 7 |
public ProblemInstance readInstance(File instanceFile) {
if(instanceFile == null){
throw new IllegalArgumentException("Parameter instanceFile null");
}
long adInventorySize = 0;
boolean adOptionParseError = false;
ArrayList<Item> items = new ArrayList();
Fi... | 7 |
public void setUserAgent(String agentString) {
if (agentString == null) {
this.getHttpClient().getParams().removeParameter(AllClientPNames.USER_AGENT);
} else {
this.getHttpClient().getParams()
.setParameter(AllClientPNames.USER_AGENT, agentString);
}
... | 1 |
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 ListNode deleteDuplicates(ListNode head) {
if (head == null)
return null;
ListNode newHead = null, cur = null;
Integer pre = null;
int count = 0;
while (head != null) {
if (pre == null) {
pre = head.val;
count++;
} else {
... | 8 |
private PropertiesCollection parseProperties(XmlPullParser parser) throws Exception {
PropertiesCollection collection = new PropertiesCollection();
PropertiesCollection.Property property = collection.new Property();
boolean done = false;
while (!done) {
int eventType = parser.next();
if (eventType == Xm... | 8 |
public void move_all(Draw panel, Ponto p1, Ponto p2, Color bg_color){
circulos_desenhados_aux.clear();
circulos_desenhados_aux.addAll(ctrCirculo.circulos_desenhados);
for (Circulo c : circulos_desenhados_aux) {
figura_selecionada = c;
ctrCirculo.circulos_desenhados.remove(c);
mover_figura_selecionada(... | 8 |
@EventHandler
public void onZombieSpawnEvent(CreatureSpawnEvent e){
r = new Random();
Entity entity = e.getEntity();
if("ZOMBIE".equals(entity.getType().toString())){
Zombie barbarianZombie = (Zombie) e.getEntity();
Zombie goldenZombie = (Zombie) e.getEntity();
... | 4 |
private void reconnect() {
shutdownSocket();
if (mServer != null) {
mServer.shutdown();
mServer = null;
}
while (true) {
try {
mServer = new Server(mSocketAddress);
mServer.setDaemon(true);
mServer.start();
} catch (Exception exception) {
// Someone else is already the server, just ... | 4 |
public static retim.Calculator unchecked_narrow(final org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
try
{
return (retim.Calculator)obj;
}
catch (ClassCastException c)
{
retim._CalculatorStub stub;
stub = new retim._CalculatorStub();
stub._set_delegate(((org.omg.CORBA.portable.... | 2 |
void stop() throws SQLException, ClassNotFoundException {
Activity activity;
// Pause() will we executed for the case "stop" is pressed being in "play" status.
pause();
if (startTime > 0 && totalTime >= TimeBO.MINIMUM_TIME_DURATION) {
try {
activity = timerPanel.getSelectedActivity();
Connection c... | 3 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
solve();
while ((line = in.readLine()) != null && line.length() != 0) {
char[] w = line.trim().toCharArray();
b... | 5 |
public void loadGeneIds(String geneIdsFile) {
//---
// Load Gene IDs data
//---
if (verbose) Timer.showStdErr("Loading Gene IDs from " + geneIdsFile);
GeneIds geneIds = new GeneIds(geneIdsFile);
// Assign to geneIDs
Pattern patternEnsg = Pattern.compile("ENSG[0-9]*");
Pattern patternEnst = Pattern.comp... | 9 |
public A1JPanel() {
setBackground(BACKGROUND_COLOUR);
loadAllCardImagesAndSetUpCardDimensions();
addKeyListener(this);
addMouseListener(this);
reset();
} | 0 |
public void paintAux(Graphics g) {
//se despliegan el score en la esquina superior izq
g.setColor(Color.RED);
g.drawString("Score: " + iScore, 20, 35);
if (entBarra != null && entBloque != null && entProyectil != null && encBloques.size() > 0) {
//Dibuja la imagen de la b... | 6 |
public static void main(String[] args) {
Callee1 callee1 = new Callee1();
Callee2 callee2 = new Callee2();
MyIncrement.f(callee2);
Caller caller1 = new Caller(callee1);
Caller caller2 = new Caller(callee2.getCallbackReference());
caller1.go();
caller1.go();
... | 0 |
@Override
public int decidePlay(int turn, int drawn, boolean fromDiscard) {
//Compute the best position for the newly drawn card (if not cached)
if (!fromDiscard || cache_turn != turn)
cache_pos = maxSequence(rack, game.rack_size, drawn, false);
return cache_pos;
} | 2 |
private void checkForPeakZ(double z) {
if (isUpPeakZ) {
if (z < lastZ) {
peakZ = lastZ;
isUpPeakZ = false;
}
} else {
if (z > lastZ) {
peakZ = lastZ;
isUpPeakZ = true;
}
}
lastZ = z;
} | 3 |
public void updateHeightmap(BufferedImage hmap) {
for (int i = 0; i < hmap.getWidth(); i++) {
for (int j = 0; j < hmap.getHeight(); j++) {
float color = new Color(hmap.getRGB(j, i)).getRed();
color /= 255f;
color -= 0.5f;
color *= 16;
terrain.setHeight(j, i, color);
}
}
} | 2 |
private int readFrameType(final Object[] frame, final int index, int v,
final char[] buf, final Label[] labels) {
int type = b[v++] & 0xFF;
switch (type) {
case 0:
frame[index] = Opcodes.TOP;
break;
case 1:
frame[index] = Opcodes.INTEGER;
break;
case 2:
frame[index] = Opcodes.FLOAT;
break... | 8 |
public void setData1i(Complex[] data, int power) {
this.power = power;
count = 1<<power;
x = new Complex[count];
fd1i = new Complex[count];
for(int i=0;i<count;i++){
x[i] = new Complex();
fd1i[i] = new Complex();
}
for(int i=0;i<count;i++){
x[i] = data[i];
}
} | 2 |
public void update() {
if(!this.changed) return;
LinkedList<String> lines = new LinkedList<String>();
for(String key: this.pushedIndexes.keySet()) {
if(this.Indexes.containsKey(key)) {
if(!this.Indexes.get(key).toString().equals(this.pushedIndexes.get(key).toString(... | 7 |
public void setEnemy(int id){
switch (id){
case 1:{
this.sprite = DisplayActions.getImage("EShip1");
this.id = 1;
this.health = 3;
this.value = 1;
this.moveSpeedX = 1;
this.moveSpeedY = 0;
... | 3 |
private void jButtonSignActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSignActionPerformed
this.jTabbedPane.setSelectedComponent(this.jPanelTabQueue);
for (int i = 0; i < this.model.getRowCount(); i++) {
if (this.model.isSelected(i)) {
SignatureFi... | 2 |
public static String getArrayType(String elementType) {
if (elementType.charAt(0) == '[')
return "[" + elementType;
else
return "[L" + elementType.replace('.', '/') + ";";
} | 1 |
public static void run(RomInfo romL, RomInfo romR, DualGbSegment segment) {
Gb.loadGambatte(2);
// load roms
Gameboy gbL = new Gameboy(romL, 0, true);
Gameboy gbR = new Gameboy(romR, 1, true);
DualGbHelper.initDualGb(gbL, gbR);
// init inital state
StateBuffer initalBufferL = new StateBuf... | 4 |
public LanguageId(String id, String name) {
this.id = id;
this.name = name;
} | 0 |
public static String getWobID(int x, int y, int z) {
try {
if ( wobjects[x][y][z] != null )
return wobjects[x][y][z].getWobID();
} catch (Exception e) {
System.out.println("BoxLoc.getWobID(): " + e);
return "OutofBound";
}
return "Vacant";
} | 2 |
public void setTile(Tile tile, int x, int y) {
if (tile != null) {
if (x >= 0 && y >= 0 && x < getWidth() && y < getHeight()) {
tiles[x][y] = tile;
}
}
} | 5 |
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 |
private static String findDigits(String str)
{
String answer = "NONE";
boolean hasFound = false;
for(int i = 0; i < str.length(); i++)
{
if((str.charAt(i) >= 'a' && str.charAt(i) <= 'j'))
{
if(!hasFound)
{
answer = "";
hasFound = true;
}
answer += str.charAt(i) - 'a';
}
el... | 6 |
public boolean isCarrying() {
if (rend != null) {
return (rend.hasImage("arm/carrying") == true);
} else return false;
} | 1 |
@Override
public void write(Session session, Packet p) {
try {
if (p.isRaw()) {
/*
* If the packet is raw, send its payload.
*/
session.getSocketChannel().write(ByteBuffer.wrap(p.getData()));
} else {
/*
* If not, get the out ISAAC cipher.
*/
// ISAACCipher outCipher = ((Pla... | 6 |
public void setxStream(XStream xStream) {
this.xStream = xStream;
} | 0 |
private boolean isCollide(Entity one, Entity two)
{
if(!(one instanceof Boss) && !(two instanceof Boss))
{
if (Math.abs(one.getX() - two.getX()) >= 50 || Math.abs(one.getY() - two.getY()) >= 50) return false;
}
ArrayList<Pair> onePairs = one.getEdges();
ArrayList<Pair> twoPairs = two.getEdges();
for... | 8 |
private void init()
{
for (int i = 0; i < NUM_ROWS; i++) // Loop through rows
for (int j = 0; j < NUM_COLUMNS; j++) // Loop through columns
gameBoard[i][j] = EMPTY;
// Left edge
for(int i = 0; i < NUM_ROWS; i++)
gameBoard[i][0] = BORDER;
// Right edge
for(int i = 0; i < NUM_ROWS; i++)
game... | 6 |
public void getUnion(Node list1, Node list2) {
if (list1 == null && list2 == null) {
return;
}
System.out.println("List 1:");
print(list1);
System.out.println("List 2: ");
print(list2);
Node newList = new Node();
while (list1 != null && list2 != null) {
if (list1.getData() < list2.getData()) ... | 8 |
public Armor makeArmor(Armors armorName) {
Armor armor = new Armor("Cloth", "Works great for peansantry. Not much else though, but hey, at least it's something right?", new Damage(6));
switch(armorName) {
case CLOTH:
armor = new Armor("Cloth", "Works great for peansantry. Not much else though, but hey, at l... | 7 |
public void remover(long pesquisaId) throws Exception
{
String sql = "DELETE FROM Pesquisapalavras_chave WHERE id1 = ?";
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql);
stmt.setLong(1, pesquisaId);
stmt.execute();
}
catch (SQLException e)
{
throw e;
... | 1 |
public void setDescription(String description) {
if (description == null) {
throw new IllegalArgumentException("Description shouldn't be NULL.");
}
this.description = description;
} | 1 |
@Override
public String getDesc() {
return "Sacrifice";
} | 0 |
@RequestMapping(value = "deleteTask")
public @ResponseBody
String deleteTask(@RequestParam Integer id, WebRequest webRequest) {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication.isAuthenticated() && (authentication.getPrincipal() instanceo... | 5 |
public double getT(double x) {
return Math.acos((x - a) / r);
} | 0 |
private boolean[] getIgnoreQueryInfo(File file, int maxQueryNumber) {
System.out.println("Reading query ignore file: " + file);
boolean[] ignoreQueries = new boolean[maxQueryNumber];
for (int i = 0; i < maxQueryNumber; i++)
ignoreQueries[i] = false;
try {
BufferedReader qmReader = new BufferedReader(new... | 7 |
private void parseNumber() throws IOException {
int c = in.peek();
while (Character.isDigit(c) || c == '_') {
out.append((char) in.read());
c = in.peek();
}
} | 2 |
protected String getPresentationText(TreeRow row, Font font, int width, boolean forHeightOnly) {
String text = getText(row);
if (mWrappingMode == WrappingMode.WRAPPED) {
return TextDrawing.wrapToPixelWidth(font, text, width);
}
if (mWrappingMode == WrappingMode.SINGLE_LINE) {
int cut = text.indexOf('\n');... | 4 |
public void preencherTabela() throws Exception
{
ArrayList<String> colunas = new ArrayList<String>();
colunas.add("id");
colunas.add("nome");
Object linhas[][] = new Object[list.size()][];
int i = 0;
for (InstituicaoCooperadora instituicaocooperadora : list)
{
linhas[i] = formatoTabela(instituicaocoop... | 3 |
public Path getImgPath_StandardBtn(Imagetype type) {
Path ret = null;
switch (type) {
case KEYFOCUS:
ret = this.imgStdBtn_KFoc;
break;
case MOUSEFOCUS:
ret = this.imgStdBtn_MFoc;
break;
case MOUSEFOCUS... | 5 |
public Color findColour(Cell cell1){
String cell = cell1.toString();
if(Character.isDigit(cell.charAt(0))){
return new Color(122, 66, 182);
} else {
switch(cell){
case ".":
return new Color(194, 129, 43);
case "#":
return new Color(126, 126, 126);
case "R":
return new Color(150, 52,... | 7 |
private boolean jj_3R_44() {
if (jj_scan_token(SEMICOLON)) return true;
return false;
} | 1 |
public final void registerFactory(Class<?> clazz, IAssetFactory<?> factory) {
factoryList.put(clazz, factory);
} | 2 |
protected double distance(Instance first, Instance second) {
double distance = 0;
int firstI, secondI;
for (int p1 = 0, p2 = 0;
p1 < first.numValues() || p2 < second.numValues();) {
if (p1 >= first.numValues()) {
firstI = m_instances.numAttributes();
} else {
firstI = first.index(p1);
... | 8 |
@Override
public List<Integer> save(List<Hotel> beans, GenericSaveQuery saveGeneric, Connection conn) throws DaoQueryException {
try {
return saveGeneric.sendQuery(SAVE_QUERY, conn, Params.fill(beans, (Hotel bean) -> {
Object[] objects = new Object[5];
objects[0] ... | 1 |
public static void main(String args[]) throws Exception {
int serverPort = 0;
boolean passes = true;
isClosed = false;
int connects = 0;
int rejections = 0;
players = new LinkedList<TictactoThreadedServer>();
rejects = new LinkedList<TictactoThreadedServer>();
TTTModelBoard sharedBoard = new TTTModelBoa... | 7 |
void setStopped(boolean value) {
final ReentrantLock l = lock;
l.lock();
try {
stopped = value;
}
finally {
l.unlock();
}
} | 0 |
private void setupMenuBar() {
final Component comp = this;
final NESModelListener listener = this;
bg = new ButtonGroup();
JMenuBar menuBar = new JMenuBar();
getContentPane().add(menuBar, BorderLayout.NORTH);
JMenu fileMenu = GUIUtilities.createMenu(menuBar, "File", 'F')... | 8 |
public static Stella_Object instantiateExternalBindings(Stella_Object self) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(self);
if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_NAMED_DESCRIPTION)) {
{ NamedDescription self000 = ((NamedDescription)(self));
}
}
... | 7 |
public Turma pesquisaTurma(String codDisciplina, int numTurma)
throws DisciplinaInexistenteException, TurmaInexistenteException {
Turma turmaPesquisada = null;
Disciplina d = this.pesquisaDisciplina(codDisciplina);
for (Turma t : d.getTurmas()) {
if (t.getNumero() == numTurma) {
turmaPesquisada = t;
... | 3 |
public void resolvePrefixes(LinkedList<Prefix> pre){
//Resolve prefix in graph name
if (name.contains(":")){
//Replace prefix
for (Prefix p:pre){
if (name.startsWith(p.getPrefix())){
name="<"+p.getIriContent()+name.substring(p.getPrefix().length())+">";
break;
}
}
}
//Resolve prefixes... | 8 |
private boolean isNewLine( Token token ) {
if ( token == null ) {
return true;
}
else if ( token.isNewLine() ) {
return true;
}
return false;
} | 2 |
public boolean validateChecksum(Object d, short checksum) {
short newChecksum = 0;
String data = d.toString();
byte[] dataBytes = data.getBytes();
for (int i = 0; i < dataBytes.length; i++) {
newChecksum += (short) dataBytes[i];
}
while ( newChecksum / 0xff != 0) {
newChecksum = (short) (newChecksu... | 3 |
public void getNewAbility() {
// TODO Auto-generated method stub
if(this.getLevel() == 2)
{
//power cleave
//deals bonus damage based on user's attack
addAbility(new PowerCleave());
}
if(this.getLevel() == 4)
{
//dexterous swing
//deals bonus damage based on user's dex
addAbility(new DexAt... | 4 |
public ArrayList<DrawableItem> getDrawable() {
return ditems;
} | 0 |
private ArrayList<String> getEvents()
{
ArrayList<String> ret = new ArrayList<String>();
String line = null;
for(;;) {
try {
if(!serverr.ready())
break;
line = serverr.readLine();
} catch(IOException e) {
e.printStackTrace();
break;
}
if(line == null)
continue;
System.err.println(line... | 4 |
private String calc(String input) {
//Person 5 put your implementation here
String res = "";
if(input.length()>2) {
res = input.substring(2, input.length()) + input.substring(0,2);
} else {
res = input;
}
return res;
} | 1 |
public int getId() {
return id;
} | 0 |
public Actionneur(int date1, int id1, int taille1) {
super(date1, id1, taille1);
} | 0 |
private ArrayList<AbstractComponent> getSentenceList(
AbstractComponent component) throws BookException {
ArrayList<AbstractComponent> list = new ArrayList<AbstractComponent>();
if (component.getType() == EComponentType.SENTENCE) {
list.add(component);
} else if (component.getType() != EComponentType.LISTIN... | 4 |
public static boolean isBlockSeparator(String s) {
if (s.startsWith("--") && s.endsWith("--")) {
return true;
}
if (s.startsWith("==") && s.endsWith("==")) {
return true;
}
if (s.startsWith("..") && s.endsWith("..")) {
return true;
}
if (s.startsWith("__") && s.endsWith("__")) {
return true;
... | 8 |
public static void main(String[] args){
Fenetre._fenster = new Fenetre();
if (Fenetre._fenster != null) {
Fenetre._working = true;
Fenetre._fenster.startThreads();
}
} | 1 |
public double getRadius() {
return radius;
} | 0 |
static public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
int advance = 0;
ListNode h1 = l1;
ListNode h2 = l2;
Queue<Integer> queue = new LinkedList<Integer>();
while(h1!=null || h2!=null) {
int value1 = (h1==null) ? 0 : h1.val;
int value2 = (h2==null) ? 0 : h2.val;
int sum = value1 + value2... | 9 |
private void calcState() {
//calculate state
if (state == State.END) {
return;
}
if (!patternCheckBound() || !matchStrCheckBound()) {
state = State.END;
} else if (patternChar() == MATCH_ALL) {
if (!patternNextCheckBound()) {
s... | 5 |
public VueAbstrait getVue(){
return vue;
} | 0 |
@Test
public void poppingReturnsSmallestElements()
{
for (int i = 0; i < 1000; i++)
heap.insert((int)(Math.random() * 10000));
int old = -1;
boolean test = true;
while (!heap.isEmpty())
{
int i = heap.pop();
if (i < old) test = false;... | 3 |
@Test
public void testKitSize(){
int size = 5;
calc = new DataCalc(inData, numberOfPoints);
calc.createDataSet(0);
outData = calc.getStructureIn();
Assert.assertTrue(outData.kitSize() == size);
} | 0 |
public void changeRule(String parameters){
//Parse Input
String[] parameterSplit = parameters.split(" ", 2);
String fileName = parameterSplit[0];
String rules = parameterSplit[1];
rules = rules.substring(1, rules.length()-1);
String ruleSplit[] = rules.split("\\|");
... | 8 |
public static BSPlayer getSimilarPlayer( String player ) {
if ( onlinePlayers.containsKey( player ) ) {
return onlinePlayers.get( player );
}
for ( String p : onlinePlayers.keySet() ) {
if ( p.toLowerCase().contains( player.toLowerCase() ) ) {
return onlin... | 3 |
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
for (int i = 0; i < 3; i++) {
g2d.drawRect(i * fieldWidth, 0, fieldWidth, fieldHeight);
}
g2d.drawString("Оригинал", field... | 4 |
public int collision(Personnage p) {
for (Teleporteur t : liste) {
if (p.getX() < t.getX1() && p.getX1() > t.getX() && p.getY() < t.getY1() && p.getY1() > t.getY()) {
p.setX(t.getxDest());
p.setY(t.getyDest());
return t.getIdMapDest();
}
... | 5 |
public static void main(String[] args) throws Throwable{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
int c=1;
for(String ln;!(ln=in.readLine().trim()).equals("STOP");c++){
if(c>1)System.out.println();
char[] st=ln.toCharArray();
System.out.println("Dataset #"+c+": The initial... | 9 |
void add(int value) {
IntQueue.Entry entry = new Entry(value);
if (tail != null)
tail.next = entry;
tail = entry;
if (head == null)
head = entry;
} | 2 |
@Override
public LocalDate deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException
{
String text = jsonParser.getText();
try
{
return localDateFormatter.parseLocalDate(text);
}
catch (Throwa... | 1 |
public static void addAccount(Messagable ui,String name, String password, String address){
boolean accountCreated = true;
if(name.isEmpty()){
accountCreated = false;
ui.sendMessage("ERROR: Enter a name.");
}
if(password.isEmpty()){
accountCreated = false;
ui.sendMessage("ERROR: Enter a password.");
... | 5 |
@Override
public List<Book> searchBook(String term) {
term = ".*" + term + ".*";
List<Book> match = new ArrayList<Book>();
for (Book book : getBooks()) {
if (book.getAuthor().matches(term) || book.getIsbn().matches(term)
|| new String(book.getPrice() + "").matches(term)
|| book.getTitle().matches(te... | 5 |
@Test
public void testCreateArray() {
System.out.println("createArray");
CosineInterpolator cosInterp = new CosineInterpolator();
LinearInterpolator linInterp = new LinearInterpolator();
for (int i = 0; i < 100; i++) {
int size = 500;
double p = Math.random() ... | 3 |
private void sampleFreqUpdate(Status status) {
long duration = TwitterCrawler.Timer.duration();
long temp = duration/Settings.sample;
int index = (int) temp;
int maxIndex = (int) (Settings.timer/Settings.sample+1);
if(index<maxIndex){
//System.out.println(duration+"ms@"+index);
HashtagEntity[] tags =... | 4 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Address)) {
return false;
}
Address other = (Address) object;
if ((this.idAddress == null && other.idAddress !=... | 5 |
private static String getStringFromDocument(Document doc) {
try {
DOMSource domSource = new DOMSource(doc);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
TransformerFactory tf = TransformerFactory.newInstance();
... | 1 |
@Override
public boolean execute(CommandSender sender, String[] args) {
if(!(sender instanceof Player)) {
return true;
}
String groupName = args[0];
Group group = groupManager.getGroupByName(groupName);
if(group == null) {
sender.sendMessage("Group doesn't exist");
return true;
}
boolean i... | 9 |
public Background(StreamLoader streamLoader, String s, int i)
{
Stream stream = new Stream(streamLoader.getDataForName(s + ".dat"));
Stream stream_1 = new Stream(streamLoader.getDataForName("index.dat"));
stream_1.currentOffset = stream.readUnsignedWord();
anInt1456 = stream_1.readUnsignedWord();
anInt1457 =... | 7 |
@Test
public void httpCount() {
Path path = Paths.get("D:\\\\Download\\SecureCRT\\logs\\clientad.yy.com.log.16.gz");
File file = path.toFile();
String dateStr = "26/Apr/2015:14";
String line = null;
int length = "[26/Apr/2015:14:".length();
int count = 0;
try (FileInputStream fis = new FileInputStr... | 5 |
void setPendingViewOffset(int xofs,int yofs) {
if (!pf_wrapx) {
if (xofs < 0) xofs=0;
if (xofs > tilex*(nrtilesx-viewnrtilesx))
xofs = tilex*(nrtilesx-viewnrtilesx);
}
if (!pf_wrapy) {
if (yofs < 0) yofs=0;
if (yofs > tiley*(nrtilesy-viewnrtilesy))
yofs = tiley*(nrtilesy-viewnrtilesy);
}
p... | 8 |
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.