text stringlengths 14 410k | label int32 0 9 |
|---|---|
private static int[] genPref()
{
int[] pref = new int[FRUIT_NAMES.length];
for (int i = 0; i != pref.length; ++i)
pref[i] = i + 1;
shuffle(pref);
return pref;
} | 1 |
public static int getPassengerCount(SimpleTrain train) {
if(train == null){
LOG.error("Train is null");
throw new IllegalArgumentException("Train is null");
}
int count = 0;
for (AbstractCarriage ac : train) {
if (ac instanceof AbstractPassengerCarriage) {
count += ((AbstractPassengerCarriage) ac).... | 3 |
public RegisterViewHelper getRegisterViewHelper(HttpServletRequest req)
throws UnsupportedEncodingException {
RegisterViewHelper registerViewHelper = new RegisterViewHelper();
if (req.getParameter("forename") != null) {
registerViewHelper.setForename(new String(req.getParameter("forename")
.getByt... | 9 |
public String getFrameIdentifier() {
return frameIdentifier;
} | 0 |
public void render(){
texture.bind();
int xChange = (change-1) % 2;
int yChange = (change-1) / 2;
if(!isDead()){
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(xChange * 0.5f,yChange * 0.5f + 0.5f);
GL11.glVertex2f(x, y);
GL11.glTexCoord2f(xChange * 0.5f + 0.5f,yChange * 0.5f + 0.5f);
GL11.glV... | 1 |
private void button7MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button7MouseClicked
if(numberofpins < 4)
{
if(numberofpins == 0)
{
Login_form.setString1("6");
}
if(numberofpins == 1)
{
Login_form.setString2("6");
}
if(numberofpins == 2)
{
Login_... | 5 |
@java.lang.Override
public boolean isValidMove(int MoveToX,int MoveToY,int MoveFromX,int MoveFromY) {
if (((MoveFromX-MoveToX)==1||(MoveFromX-MoveToX)==-1)&&((MoveFromY-MoveToY)==2||(MoveFromY-MoveToY)==-2)){
return true;
}
if (((MoveFromX-MoveToX)==2||(MoveFromX-MoveToX)==-2)&&((MoveFrom... | 8 |
public void reset() {
double[][] map = new double[_source.length][_source[0].length];
double scale = 1023.0 / (double) _maxValue;
for (int i = 0; i < map.length; i++) {
double[] row = map[i];
for (int j = 0; j < row.length; j++) {
map[i][j] = _source[i][j] * scale;
}
}
_map = map;
} | 2 |
public static boolean buyProduct(Integer id) {
Session session = HibernateUtil.getSessionFactory().openSession();
Query query = session.createQuery("from Product where id = :id");
query.setParameter("id", id);
Product product = (Product)query.uniqueResult();
if(product!=null && ... | 2 |
public void tick() {
} | 0 |
private void write(Map<String,Map<String,SerAnnotatedElement>> output, Map<String,Collection<Element>> originatingElementsByAnn) {
for (Map.Entry<String,Map<String,SerAnnotatedElement>> outputEntry : output.entrySet()) {
String annName = outputEntry.getKey();
try {
Map<St... | 9 |
@Override
public int compareTo(ValueIndexPair o) {
return sum < o.sum ? -1 : (sum > o.sum ? 1 : 0);
} | 2 |
* @return The column, or <code>null</code> if none is found.
*/
public Column overColumn(int x) {
int pos = getInsets().left;
int count = mModel.getColumnCount();
for (int i = 0; i < count; i++) {
Column col = mModel.getColumnAtIndex(i);
if (col.isVisible()) {
pos += col.getWidth() + (mDrawColumnDivi... | 4 |
Errors(String name) {
this.value = name;
} | 0 |
@Override
public synchronized Message process(ClientState state, Message request)
{
String xmlString;
Model model = Model.getInstance();
Message response = null;
Node child = request.contents.getFirstChild();
String myKey = child.getAttributes().getNamedItem("key").getNodeValue();
// check the key and i... | 8 |
public static boolean eval(String expression) {
if (expression == null) return false;
String[] comparitors = new String[] {"<=",">=","<>","!",">","<","="};
int i;
for (i=0; i < comparitors.length; i++) {
if (expression.contains(comparitors[i])) {
String[] split = expression.split(comparitors[i]);
re... | 3 |
public void save() {
try {
file.openWr(dir + "\\" + getNick() + ".txt");
file.write(hpass);
file.write(getWins());
file.write(getLoses());
file.close();
} catch (Exception e) {
empty();
ExceptionLog.println("Ошибка: Не у... | 1 |
public Employee(String n, double s)
{
name = n;
salary = s;
hireDay = new Date();
} | 0 |
private void populateCombos() {
String imgQuality = device.getProperty(Device.IMAGE_QUALITY);
String pollRate = device.getProperty(Device.POLLING_RATE);
int qualityPosition = 0;
int pollPosition = 0;
if (imgQuality == null) {
imgQuality = Integer
.toString(IConnectionConstants.DEFAULT_IMAGE_QUALITY);... | 6 |
public List<String> getString() {
if (string == null) {
string = new ArrayList<String>();
}
return this.string;
} | 1 |
@Before
public void setUp() {
} | 0 |
@Override
public void run() {
Thread.currentThread().setName("Shutdown");
try {
LOG.info("The \"UCP and SMMP Proxy\" is shutting down");
// Do whatever has to be done here to cleanup the module before complete shutdown
LOG.info("The \"UCP and SMMP Proxy\" shutted ... | 1 |
private void renderFormalTypeParameters(JavaBytecodeSyntaxDrawer sd, Imports ia, List<FormalTypeParameter> typeParams) {
boolean displayExtendsObject = SystemFacade.getInstance().getPreferences().isSettingTrue(Settings.DISPLAY_EXTENDS_OBJECT);
if (typeParams != null && typeParams.size() > 0) {
sd.drawDefault("<"... | 9 |
public void setDescription(String description) {
this.description = description;
} | 0 |
public EntityServlet() {
super();
} | 0 |
public void combat(Unit attacker, Unit defender, int round) {
if (round < 100) {
if (attacker.range > defender.range)
// Prüfen ob der Verteidiger sich wehren kann
{
defender.setHP(defender.hp - r.nextInt(attacker.attack) * attacker.hp / 100);
// ranged Schadensberechnung wip
return;
} el... | 6 |
public static ArrayList<Book> checkBookReservation(ArrayList<BookCopy> bookList) {
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ArrayList<B... | 6 |
public ProblemList getProblemList() {
return problemList;
} | 0 |
TermInfosReader(Directory dir, String seg, FieldInfos fis, int readBufferSize, int indexDivisor)
throws CorruptIndexException, IOException {
boolean success = false;
if (indexDivisor < 1 && indexDivisor != -1) {
throw new IllegalArgumentException("indexDivisor must be -1 (don't load terms index) o... | 8 |
@SuppressWarnings("unchecked")
public void add(int index, T theElement)
{
if(index < 0 || index > size)
throw new IndexOutOfBoundsException("index = " + index + " size = " + size);
if(size == element.length)
{
T[] old = element;
element = ( T[] ) new Object[2 * size];
System.arraycopy(old, 0, el... | 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 trimaLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 30;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return -1;
return optInTimePeriod-1;
} | 3 |
public void close(){
try {
acceptthread.stop();
if (s != null) {
s.close();
for (Client c: clients) {
c.close();
}
}
gui.close();
} catch (IOException e) {
e.printStack... | 3 |
public void renderTopFace(Block block, double d, double d1, double d2, int i) {
Tessellator tessellator = Tessellator.instance;
if (this.overrideBlockTexture >= 0) {
i = this.overrideBlockTexture;
}
int j = (i & 15) << 4;
int k = i & 240;
double d3 = ((doubl... | 9 |
private String sourceLastUpdated() {
XPath xpath = XPathFactory.newInstance().newXPath();
String updated = "";
try {
Document doc = DocumentBuilderFactory.newInstance()
.newDocumentBuilder()
.parse("service-names-port-numbers.xml");
updated = xpath.evaluate("/registry/updated", doc);
} catch (XP... | 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 boolean allowScreenDownMode() {
if (!allowScreenOrPrintRenderingOrInteraction())
return false;
if (getFlagNoView() && !getFlagToggleNoView())
return false;
return !getFlagReadOnly();
} | 3 |
@Test
public void testGreater2PowersExponent() {
logger.info("greater2PowersExponent");
int[] number = {0, 1,2, 3,4, 5,6,7,8, 9,10,11,12,13,14,15,16,17,18,19,20};
int[] expResult = {0, 0,1, 2,2, 3,3,3,3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5};
for (int i = 0; i < number.length; i++... | 1 |
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter number M: ");
int m = sc.nextInt();
System.out.println("Enter number N: ");
int n = sc.nextInt();
if (n < m) {
int helper = n;
n = m;
m = helper;
}
String numbersDivisibleBy3 = "";
St... | 5 |
public void setCurrentItemByPath(String relativePath){
File file = new File(ProjectMgr.getAssetsPath(), relativePath);
if(!file.exists()){return;}
List<File> files = new ArrayList<File>();
while(file.getParent() != null && !file.getParent().equals(ProjectMgr.getAssetsPa... | 6 |
@Override
public boolean tallenna() {
try {
FileWriter kirjoitin = new FileWriter(rekisteri);
for (int i = 0; i < tyopaivat.size() - 1; i++) {
kirjoitin.write(tyopaivat.get(i).tallennusMuoto() + "\n");
}
if (!tyopaivat.isEmpty()) { // viimeisen... | 3 |
public String getParamValue(String configKey, String paramKey) {
if (key.equalsIgnoreCase(configKey)) {//search own
for (Param param : params) {
String ret = param.get(paramKey);
if (ret != null) {
return ret;
}
}
... | 6 |
@Override
public void checkPropertyAccess(String key) {
// allow access to some harmless properties
switch (key) {
case "line.separator":
case "user.dir":
case "file.separator":
case "java.class.version":
case "file.encoding":
case "java.compiler":
case "user.timezone":
case "user.country":... | 8 |
public String getLabel() {
return label;
} | 0 |
public LookupSwitchInsnNode(final LabelNode dflt, final int[] keys,
final LabelNode[] labels) {
super(Opcodes.LOOKUPSWITCH);
this.dflt = dflt;
this.keys = new ArrayList(keys == null ? 0 : keys.length);
this.labels = new ArrayList(labels == null ? 0 : labels.length);
if (keys != null) {
for (int i = 0; i... | 5 |
public Object getValueAt(int rowIndex, int columnIndex) {
if (dados != null && rowIndex < dados.size()) {
Cad_Produto_TO e = (Cad_Produto_TO) dados.get(rowIndex);
if (columnIndex == 0) {
return e.getTxt_produto();
}
if (columnIndex == 1) {
... | 9 |
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 fe... | 6 |
private CompanyCollection readAllCompaniesFromFile()
{
CompanyCollection allCompanies = new CompanyCollection();
try
{
CsvReader csvReader = new CsvReader(sourceFile);
if(csvReader.readHeaders() == true)
{
while(csvReader.readRecord()==true)
{
//apar_id,apar_name,address,place,province,Cou... | 7 |
public static void main(String[] args) {
List<Integer> list = new ArrayList<>();
for (int i = 0; i < 100; i++) {
list.add((int) (Math.random() * 100));
}
Collections.sort(list);
System.out.println("Sorted Array: " + list);
int testNumber = 10;
int index = Collections.binarySearch(list, testNumber);
... | 2 |
public void simular(){
int i=0;
do{
if(te[0]<tr){ //CASO 1
t=te[0];
r=r+1;
if(r==s+1){
T=t;
System.out.println("\nEl sistema FALLO en instante "+T);
Syste... | 8 |
private float getValueAsFloat(String value, float defaultFloat) {
try {
return Float.valueOf(value);
} catch(NumberFormatException e) {
e.printStackTrace();
}
return defaultFloat;
} | 1 |
public void searchRoundTripFlights() {
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("Where is your MySQL JDBC Driver?");
e.printStackTrace();
}
PreparedStatement ps = null;
Connection c... | 6 |
public float unitize()
{
assert (vertices != null);
float maxx, minx, maxy, miny, maxz, minz;
float cx, cy, cz, w, h, d;
float scale;
/*
* get the max/mins
*/
maxx = minx = vertices[3 + 0];
maxy = miny = vertices[3 + 1];
maxz = minz... | 8 |
public void saveAsIco(OutputStream out) throws IOException {
byte[] buffer = new byte[16];
int count = 0;
int[] sizes = new int[] { 256, 128, 64, 48, 32, 16 };
for (int size : sizes) {
if (hasImage(size)) {
count++;
}
}
EndianUtils.writeLEShort(0, buffer, 0);
EndianUtils.writeLEShort(1, buffer, ... | 7 |
@Override
public String toString() {
return "fleming.entity.Sintoma[ idSintomas=" + idSintomas + " ]";
} | 0 |
public int getIndexOfChild(Object parent, Object child) {
Iterator iter = ((TreeElement) parent).getChilds().iterator();
int i = 0;
while (iter.next() != child)
i++;
return i;
} | 1 |
public Chess1(String title){
super(title);
Dimension boardSize = new Dimension(800, 800);
layeredPane = new JLayeredPane();
getContentPane().add(layeredPane);
layeredPane.setPreferredSize(boardSize);
layeredPane.addMouseListener(this);
layeredPane.addMouseMotionListener(this);
chessB... | 6 |
private int calculateNewDelay()
{
//core.setMessageDelay((long)(500/(1+500*Math.pow(2, messagesQueue.size() * 2))));
return (int)(500/(1+500*Math.pow(2, messagesQueue.size() * 2)));
} | 0 |
public boolean disparar() throws ExceptionDisparo{
Logger.log(LogLevel.DEBUG, "Mina Retardad["+this.getPosicion().getX()+","+this.getPosicion().getY()+"]: turnos restantes: " + retardo);
if (this.retardo-- <= 0){
ArrayList<Posicion> posiciones = radioPosicion(posicion, this.radio);
ArrayList<Nave> naves;
i... | 5 |
@Override
public List<Funcionario> listAll() {
Connection con = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<Funcionario> funcionarios = new ArrayList<>();
try {
con = ConnectionFactory.getConnection();
pstm = con.prepareStatement(L... | 3 |
StarSystem(Ticker ticker) {
super(ticker);
world.setAmbientLight(100, 100, 100);
world.getLights().setRGBScale(Lights.RGB_SCALE_2X);
adapter = new AdapterPhysics(world);
} | 0 |
public int getNumAreaAtPosition(int x, int y) {
if (y > 660) {
return -1;
}
int widthWindow = AppliWindow.getInstance().getWidth();
int heightWindow = AppliWindow.getInstance().getHeight();
int xMap = x * this.widthMap / widthWindow;
int yMap = y * this.heightMap / heightWindow ;
if(xMap<0 ... | 5 |
@Test
public void runTestAnonymousClass1() throws IOException {
InfoflowResults res = analyzeAPKFile("Callbacks_AnonymousClass1.apk");
Assert.assertNotNull(res);
Assert.assertEquals(1, res.size()); // loc + lat, but single parameter
} | 0 |
public static ArrayList<Polygon> getPolygonList()
{
try{
SAXBuilder sxb = new SAXBuilder();
try
{
// File reading
Document xmlFile = sxb.build("dbPattern.xml");
Element racine = xmlFile.getRootElement();
String patternName, position;
ArrayLi... | 7 |
public byte[] getConsensusSequence() {
if (consensusPos!=-1) getConsensusBreakpointPosition();
StringBuilder consensus = new StringBuilder();
int pos = matrixStart;
for (int[] vote : votingMatrix) {
if (((increment==-1) && pos > consensusPos) || ((increment==1) && pos < consensusPos)) {
pos += increme... | 9 |
public void draw(BufferedImage canvas, boolean drawEdge, boolean drawCorners)
{
for (int y = 2; y < _height-2; y++)
for (int x = 2; x < _width-2; x++)
{
if (_image[y][x] == FILLED)
{
canvas.setRGB(x + _left, y + _top, ImageSegmenter._drawColor[_type]);... | 8 |
public static void main(String[] args)
{
if (args.length > 1)
{
try
{
BufferedImage image = ImageIO.read(new File(args[0]));
if (image != null)
{
ASCIIfier asciifier = new ASCIIfier(image);
if (args.length > 2)
{
float fontSize = ... | 4 |
public List<T> getVoisinsNonNull(T[][] locations, int posX, int posY) {
List<T> voisins = new ArrayList<T>();
for (int i = ((posY - 1) < 0 ? 0 : posY - 1); i <= posY + 1
&& i < locations.length; i++) {
for (int j = ((posX - 1) < 0 ? 0 : posX - 1); j <= posX + 1
&& j < locations[0].length; j++) {
if ... | 9 |
private void jButtonClientAjouterMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButtonClientAjouterMouseClicked
String nom= jTextFieldClientNom.getText();
String prenom= jTextFieldClientPrenom.getText();
String email= jTextFieldClientEmail.getText();
Vil... | 1 |
public static void main(String[] argv)
{
// Retrieve command line arguments
if (argv.length < 2) {
System.out.println("java DBEmployeeServer <EmployeeSurname> <EmployeeObjectName>");
return;
}
Connection db... | 5 |
void processaDefunto()
{
int i, j;
for(i = 0; i < l; i++)
for(j = 0; j < c; j++)
if((mapa_atual[i][j].tipo == DEFUNTO)&&((mapa_prox[i][j].tipo == DEFUNTO)||(mapa_prox[i][j].tipo == NADA)))
{
//if(--mapa_atual[i][j].vida == 0)
// mapa_prox[i][j] = new Celula(NADA,0);
//else
mapa_prox... | 5 |
private void findMax() {
int m = 0;
for (int i = 1; i < array.length; ++i) {
if (array[i].getValue().compareTo(array[m].getValue()) > 0) {
m = i;
}
}
max = array[m];
} | 2 |
* @return True if it is, false if not.
*/
private boolean isEndingPunctuation(char input){
return input == '.' || input == '!' || input == '?' || input == ';' || input == ':' || input == '|';
} | 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 |
public String toString() {
return (userID == null ? "" : userID + ", ") + (firstName == null ? "" : firstName + " ")
+ (lastName == null ? "" : lastName) + (klass == null ? "" : ", " + klass)
+ (institution == null ? "" : ", " + institution) + (state == null ? "" : ", " + state)
+ (country == null ? "" : ... | 8 |
@Override
public PastMeeting getPastMeeting(int id) {
Meeting returnMeeting = getMeeting(id);
if(returnMeeting != null) {
if(returnMeeting.getDate().after(timeNow())) {
throw new IllegalArgumentException();
} else {
return (PastMeetingImpl) ret... | 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 Mark)) {
return false;
}
Mark other = (Mark) object;
if ((this.idMark == null && other.idMark != null) || (this... | 9 |
public static final void setMaximumPrecision(int p)
{
if(p == currMpipl)
return;
currMpipl = p;
mpmcr=MPMCRX;
mpird=1;
mpipl = currMpipl;
mpiou = 56;
mpiep = 10 - mpipl;
mpwds = (int)((mpipl / 7.224719896) + 1);
mp2 = mpwds + 2;
mp21 = mp2 + 1;
mpoud = mpio... | 6 |
private ArrayList<Operadores> getListaOperadores() {
int usados = NUMEROS.size() - 1;
ArrayList<Operadores> operadores = new ArrayList<>();
for (int i = 0; i < usados; i++) {
int operador = NumeroAleatorio.generaNumero(1, Operadores.values().length);
if (Operadores.SUMA.g... | 5 |
void skipUntil(String delim) throws java.lang.Exception
{
while (!tryRead(delim)) {
readCh();
}
} | 1 |
public void setupVertices(int width, int height) {
// We'll define our quad using 4 vertices of the custom 'TexturedVertex' class
VertexData v0 = new VertexData(); {
v0.setXYZ(0, 0, 0);
v0.setRGB(1, 0, 0);
v0.setST(0, 0);
}
VertexData v1 = new VertexData(); {
v1.setXYZ(0, height, 0);
v1.setRGB(0,... | 1 |
private String getLabelString() {
// Assumes relocation labels at beginning of instruction (in first path)
String label = null;
boolean foundLabel = false;
for (ArrayList<String> path : legitAssemblyOpTreePaths) {
for (String term : path) {
if (term.equals("LABEL"))
foundLabel = true;
if... | 4 |
public synchronized void FileReader(){
String filePath = "C:/JavaFiles/QuizManager/QuizMasterFile.csv";
String playerFilePath="C:/JavaFiles/QuizManager/Players.csv";
String resultFilePath = "C:/JavaFiles/QuizManager/Results.csv";
File file = new File(filePath);
File playerFile = new File(playerFilePath);
... | 8 |
private static ArrayList<Character> rollCharacters()
{
// TODO create 100 Random Characters
// The Race's assigned should be pretty random
// Each Character's
// level must be 1-85
// strength, 0-100
// armour, 0-100
// find and fix the bug
ArrayList<Character> retval = new ArrayList<Cha... | 1 |
private void distinguishTour(SessionRequestContent request) {
List<Tour> list = (List<Tour>) request.getSessionAttribute(JSP_TOUR_LIST);
String selectId = request.getParameter(JSP_SELECT_ID);
Integer idTour = null;
if (selectId != null) {
idTour = Integer.decode(selectId);
... | 5 |
final void addDisturbance(int radius, int chunkX, int chunkY, int chunkZ, double xVel, double yVel, double zVel)
{
// Limited to below the surface layer and above the thermocline layer
// For each depth in the range
for (int y = Math.max(1, chunkY - radius); y < Math.min(ySize - 2, chunkY + radius); y++)... | 7 |
private void afficherComptesRendus(){
if (ctrlMenu == null) {
VueMenu vueM = new VueMenu(ctrlA);
ctrlMenu = new CtrlMenu(vueM, vueA);
}
if (ctrlComptesRendus == null) {
VueComptesRendus vueCR = new VueComptesRendus(ctrlA);
ctrlComptesRendus = new C... | 2 |
public void start() {
// 下面的代码都是可以直接在Netty的官网里看到的,不仔细注释
_factory = new NioServerSocketChannelFactory(
// TODO: 需要写性能测试用例已验证cached thread pool是否够用?
Executors.newCachedThreadPool(),
Executors.newCachedThreadPool());
ServerBootstrap bootstrap = new ServerBootstrap(_factory);
bootstrap.s... | 1 |
private static void allSizes(String name, int children, MonteCarloNpv npv, StopWatch sw) {
int[] chunkSizes = { 100, 500, 1000, 2000 };
for (int i : chunkSizes) {
oneSize(name, children, i, npv, sw);
}
} | 1 |
private List<IArticle> loadArticles(Reader articlesFile) throws IOException {
List<IArticle> result = new ArrayList<>();
BufferedReader in = new BufferedReader(articlesFile);
String line;
while ((line = in.readLine()) != null) {
if (!EMPTY_LINE_PATTERN.matcher(line).matches()... | 3 |
public void setColsCount(int colsCount) {
m_colsCount = colsCount;
fitVectorsToSize();
} | 0 |
public void removeRunningTask(Task task) {
for(Task t:taskQueue){
if(t.getJob().getID() == task.getJob().getID() && t.getTaskID() == task.getTaskID()){
if(t instanceof MapperTask &&task instanceof MapperTask)
taskQueue.remove(t);
if(t instanceof ReducerTask &&task instanceof ReducerTask)
taskQueu... | 7 |
public int getPaintImageIndex(int[][] currentBlockArray, BufferedImage[] images, int x, int z, int xMin, int xMax, boolean bottomLevel) {
int[][] pixels = null;
int i = -1;
int fit = 0;
int count = 0;
do {
i = Rand.getRange(0, images.length-1);
pixels = ge... | 5 |
private static String filterToken(String s, int start, int end) {
StringBuffer sb = new StringBuffer();
char c;
boolean gotEscape = false;
boolean gotCR = false;
for (int i = start; i < end; i++) {
c = s.charAt(i);
if (c == '\n' && gotCR) {
// This LF is part of an unescaped
// ... | 6 |
public boolean isEmpth()
{
return queueList.isEmpty();
} | 0 |
private List<ProtectionEntry> listAllDependingEntries(ProtectionEntry entry, ConnectionWrapper cw) throws SQLException
{
List<ProtectionEntry> res = dependingCache.get(entry);
if (res==null)
{
res = new ArrayList<ProtectionEntry>();
StringBuilder statement = new StringBuilder(100);
statement.append("SE... | 2 |
public TransitionExpanderTool(AutomatonPane view, AutomatonDrawer drawer,
ConversionController controller) {
super(view, drawer);
this.controller = controller;
} | 0 |
public boolean hasAlias(String alias) {
if (alias.equalsIgnoreCase(cmdName))
return true;
if (aliases == null || aliases.length == 0)
return false;
for (String s : aliases) {
if (alias.equalsIgnoreCase(s))
return true;
}
return false;
} | 5 |
private void playGame(Player player, Dealer dealer) {
String inputVal = "";
System.out.println(Constants.WELCOME_MESSAGE);
while (true) {
if (player.getNumChips() >= Constants.MIN_BET_CHIPS) {
System.out
.println(Constants.BET_MESSAGE + player.getNumChips());
inputVal = inputScanner.nextLine();
... | 8 |
private void manageGameStartMessage(int senderID, GameStartMessage msg) {
if (gameServer == null) {
console.displayMessage("Got game start message but game server is null. Dropping message.");
return;
}
for (int i = 0; i < clients.size(); i++) {
if (clients.get(i).getID() == senderID) {
//Client has ... | 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.