text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public Venda ListById(int id_fornecedor) {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
Venda v = new Venda();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(LISTBYID);
r... | 3 |
public static int countVertices(Poly p, Segment s) {
int count = 0;
for(int i = 0; i < p.size(); i++) {
if(containsPoint(s, p.get(i))) {
count++;
}
}
return count;
} | 2 |
public static void main(String[] args) {
// ArrayMerge am = new ArrayMerge();
// int[] a = { 1, 2, 9, 10, 13, -1, -1, -1, -1, -1, -1, -1 };
// int[] b = {4,5,7,9,11,12,14};
//
// am.merge(a, b, 5, 7);
// for(int i = 0; i<a.length;i++){
// System.out.print(a[i]+" ");
// }
// int[] sa = {3,6,7,9,11,12... | 1 |
public FlyAWayView(SingleFrameApplication app) {
super(app);
initComponents();
Controller.Instance().addObserver(this);
this.renderMarqueeText();
// status bar initialization - message timeout, idle icon and busy animation, etc
ResourceMap resourceMap = getResourceMap()... | 9 |
public static int[][] loadMethod(File file) {
try {
FileReader reader = new FileReader(file);
BufferedReader br = new BufferedReader(new FileReader(file));
String line;
ArrayList<ArrayList<Integer>> posList = new ArrayList<ArrayList<Integer>>();
while ... | 5 |
public Value get(Key key1)
{
if (size() > 0)
{
Node<Key, Value> x = root;
while(x != null)
{
int cmp = key1.compareTo(x.key1); //compare with the left key of Node
if (cmp < 0)
{
x = x.left;
}
else if (cmp > 0) //big... | 7 |
public void startElement(String name)
throws IOException, XMLWriterException {
if (!bDocumentOpen) {
throw new XMLWriterException(
"Can't start new element, no open document.");
}
if (bStartTagOpen) {
w.write(">" + newLine);
}
... | 2 |
ArrayList<movePair> possibleMoves(Point[] grid, Pair pr) {
ArrayList<movePair> possible = new ArrayList<movePair>();
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
Point currentPoint = pointAtGridIndex(grid, i, j);
if (currentPoint.value == 0) {
continue;
}
for (Pair d : d... | 6 |
public static ArrayList<ArrayList<Integer>> combine2(int n, int k) {
if(n<k||k==0) return null;
ArrayList<ArrayList<Integer>> all = new ArrayList<ArrayList<Integer>>();
// boundary case
if(n==k) {
ArrayList<Integer> al = new ArrayList<Integer>();
for(int i=1;i<=n;++i) {
... | 6 |
@Override
public void keyPressed(int k) {
if(k == KeyEvent.VK_ENTER){
select();
}
if(k == KeyEvent.VK_UP) {
currentChoice--;
if(currentChoice == -1) {
currentChoice = options.length - 1;
}
}
if(k == KeyEvent.VK_DOWN) {
currentChoice++;
if(currentChoice == options.length) {
currentCh... | 5 |
private void readLine() {
try {
line = bf.readLine();
lineCount++;
pos = 0;
lastPos = 0;
}
catch ( IOException e ) {
e.printStackTrace();
}
} | 1 |
private String validateDirective(String directive) {
directive = directive.substring(directive.indexOf(".") + 1, // Retrieve the directive from the line w/o the period
directive.indexOf(" ")); // Stop at the end of the directive (Do not fetch the operand)
for (String dir : directives) {
if (di... | 2 |
private void drawHUD(Graphics g) {
boolean underground = yOffset <= -GameModel.GROUND_LEVEL;
// Version
g.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12));
g.setColor(Color.WHITE);
g.drawString(Configurables.GAME_VERSION, 5, getHeight() - 10);
// Money
g.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 24))... | 4 |
public static JSONObject toJSONObject(java.util.Properties properties) throws JSONException {
JSONObject jo = new JSONObject();
if (properties != null && !properties.isEmpty()) {
Enumeration enumProperties = properties.propertyNames();
while(enumProperties.hasMoreElements()) {
... | 3 |
private IBlock createBlock(int index) throws IOException {
if (storageMode != StorageMode.File) {
if (allowedMaxOffHeapBlockCount < 0) {
return new DefaultStorageBlock(dir, index, capacityPerBlock, StorageMode.File);
}
allowedMaxOffHeapBlockCount --;
... | 2 |
public static boolean updateOperatorCardinality(Operator o,
Map<String, Integer> tableAliasToId,
Map<String, TableStats> tableStats) {
if (o instanceof Filter) {
return updateFilterCardinality((Filter) o, tableAliasToId,
tableStats);
} else if (o i... | 8 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Student other = (Student) obj;
if (gender != other.gender)
return false;
if (id != other.id)
return false;
if (name == null) {
if (o... | 8 |
private int pruneLists(String desc, HashedMap<ByteChars, java.util.ArrayList<ResourceData>> cache,
int lowater, int hiwater)
{
long min_age = dsptch.getSystemTime() - config.minttl_lookup;
int delcnt = 0;
java.util.Iterator<ByteChars> it = cache.keysIterator();
while (it.hasNext()) {
if (pruneList(cache,... | 9 |
public void calculateVelocity() {
// If the current velocity is 0, simply add the acceleration to it
if (velocity.equals(new Vector())) {
velocity.add(acceleration);
}
// Otherwise,
else {
// If the couch is moving forward
if (movingForward()) {
// And it is accelerating backwards (braking)
... | 7 |
public void setTime(String newTime) {
time = newTime;
} | 0 |
@Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
} | 0 |
private void chooseOrder() {
print("Choosing order.");
choiceFound = false;
boolean poor = false;
// check if poor
if (money <= menu.getCheapestItem())
poor = true;
while (!choiceFound) {
if (pastChoices.size() == menu.getSize()) {
print("No more choices available...");
event = AgentEvent.n... | 9 |
public void mouseMoved(int x, int y) {
if ((x >= theComponent.getX()) && ((x <= (theComponent.getX() + buttonWidth)))) {
if ((y >= theComponent.getY()) && (y <= (theComponent.getY() + buttonHeight))) {
if ((y > theComponent.getY()) && (y < (theComponent.getY() + buttonHeight))) {
... | 6 |
public static void computeCoefficients(Artist[] artists,DatabaseConnector db,int k){
String stringArtists="";
int i=0;
for(Artist a:artists){
if(i>0){stringArtists+=",";}
stringArtists+="\""+a.name+"\"";
i++;
}
String[] topTags=new String[k];
String query="select tag,sum(count) as c from artisttags... | 8 |
public void addQuizGPS(String title,int quizId,ArrayList<String> imageList, ArrayList<Boolean> imageInventoryList,ArrayList<String> soundList,
ArrayList<Boolean> soundInventoryList, int narration,String paragraphList, String preNote, String postNote,
String goTo, int points, String date,double x,double y,
... | 0 |
private Map<String, TermObject> search_by_phrase(String phrase)
{
TermObject _to = null;
List<String> terms = this.split_phrase_into_terms(phrase);
Map<String, TermObject> _result = new HashMap<String, TermObject>();
int _num_t = terms.size();
if(_num_t < 1) return null;
try
{
for(int i = 0;... | 9 |
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (evt.getSource() == okButton) {
SetConfig.this.okButtonActionPerformed(evt);
}
else if (evt.getSource() == cancelButton) {
SetConfig.this.cancelButtonActionPerformed(evt);
}
... | 3 |
public Animate(BufferedImage[] images,
int startingIndex, int loopCount, boolean reverseWhenDone, boolean removeWhenDone, long timePerImage) {
this.children = images;
if (images == null) {
logger.error(new NullPointerException(), "images given to Animation component were null");
}
if (startingIndex < 0 ... | 4 |
public void draw(Graphics2D g2) {
try {
stageManager.draw(g2);
if (showFps) {
g2.drawString(Main.version, WIDTH - 60, 15);
g2.drawString("FPS: " + fps, WIDTH - 60, 30);
}
Graphics g = this.getGraphics();
if (g != null) {
g.drawImage(image, 0, 0, WIDTH * 2, HEIGHT * 2, null);
g.dispose(... | 3 |
public static int menu(String question, ArrayList<String> menu){
if(menu.size() <= 0) {
return -1;
}
else if(menu.size() == 1) {
return 0;
}
out.println(question);
for(int i = 0; i < menu.size(); i++){
out.println((i + 1) + ": " + menu.get(i));
}
int choice = in.nextInt... | 5 |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("************ Calling Captcha Servlet *********");
ServletOutputStream outputStream=null;
BufferedImage captchaImg=null;
try {
GRSCaptchaUtil grsCaptchaUtil = GRSCaptcha... | 6 |
public void applyConfig(JsonObject values) {
for (Map.Entry<String, JsonElement> entry : values.entrySet()) {
switch (entry.getKey()) {
case "prefix": prefix = entry.getValue().getAsString(); break;
case "name": name = entry.getValue().getAsString(); break;
case "title": title = entry.getValue().getAsS... | 9 |
protected MyPGPid(byte[] buffer, short offset, byte length) {
// G+D uses non-zero offset, JCOP uses offset=0
if(length > 9) {
// data offset is used for application specific parameter.
// initialization with default offset (AID offset).
short dataOffset = offset;
// Ins... | 4 |
public static JMenu makeMenu(String items, String label, int shortcuts[])
{
JMenu ret = new JMenu();
if (label != null) ret.setText(label);
String[] a = items.split("\\|");
int i = 0;
for (String b : a)
{
if (b.equals("-"))
ret.addSeparator();
else
{
JMenuItem tmenui = new JMenuItem();
... | 6 |
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 |
public void setRoom(int x, int y, Room newRoom) {
// if we're adding a real room to an empty place, howManyRooms++
if ((newRoom != null) && (myWorld[x][y] == null)) {
howManyRooms++;
} // if we're blanking (nulling) a real room, howManyRooms--
else if ((newRoom == null) && (... | 8 |
public static List<Question> getQuizQuestions(int QuizDbId)
{
try
{
String query = String.format("select qq.QUIZID, q.QUESTIONID, q.QUESTIONTEXT, q.ISVALIDATED, qa.ANSWERID, qa.ANSWERTEXT, qa.ISCORRECT from Question q right join \n" +
"QuestionAnswer qa on Q.QUESTIONID = \n" +
"qa.QUESTI... | 4 |
@Test
public void testInvalidConstruction() {
Tile t;
try {
t = new Tile(null, new Room());
fail("IllegalArgumentException was expected");
}
catch (IllegalArgumentException e){
//expected
}
try {
t = new Tile(new Point(1, 2), null);
fail("IllegalArgumentException was expected");
}
catch ... | 3 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UrlEntity url1 = (UrlEntity) o;
if (count != null ? !count.equals(url1.count) : url1.count != null) return false;
if (lastTime != null ? !lastT... | 9 |
@Override
public boolean equals(Object other) {
if (other == null || !other.getClass().equals(this.getClass())) {
return false;
}
Revision revision = (Revision) other;
boolean boolCommitID = commitID.equals(revision.commitID);
boolean boolParentIDToDiffF... | 8 |
private void readPrefixes() throws Exception {
String path = PATH + "router-" + router_number + ".txt";
BufferedReader br = new BufferedReader(new FileReader(path));
String line;
/* Reads the file line-by-line */
while ((line = br.readLine()) != null) {
/* Skips lines that don't start "prefix "... | 7 |
private void jTextField4KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField4KeyPressed
if (evt.getKeyCode() == 38) {
jTextField3.grabFocus();
} else if (evt.getKeyCode() == 40) {
jList1.grabFocus();
} else if (evt.getKeyCode() == 39) {
cmbPublisher.grabFocus();
... | 3 |
@Override
public String toString(){
if(map.isEmpty())
return "empty mapping";
String result = "";
for(Map.Entry<Byte, Byte> entry: map.entrySet()){
result += ", "+(char)entry.getKey().byteValue()+"->"+ (char)entry.getValue().byteValue();
}
return resul... | 2 |
public void testFoundColony() {
Game game = getGame();
Map map = getCoastTestMap(plainsTileType);
game.setMap(map);
Colony colony = getStandardColony(3, 1, 8);
Player dutch = colony.getOwner();
Tile colonyTile = colony.getTile();
assertEquals(colonyTile.getType()... | 8 |
public int getPlayer1Score() {
boolean test = false;
if (test || m_test) {
System.out.println("Game :: getPlayer1Score() BEGIN");
}
if (test || m_test) {
System.out.println("Game :: getPlayer1Score() END");
}
return m_player1Score;
} | 4 |
public static <T extends DC> Set<Pair<T,T>> getPhiMax(Set<Set<Pair<T,T>>> allPhis)
{ Similarity simMax,sim;
if(allPhis!=null)
{ Set<Pair<T,T>> phiMax=allPhis.a;
simMax=getPhiSim(allPhis.a);
for(Set<Set<Pair<T,T>>> p=allPhis;p!=null;p=p.next)
{ sim=getPhiSim(p.a);
if(sim.greater(simM... | 4 |
@Override
public ArrayList<BoardPosition> getPossibleDestinations(Board board) {
ArrayList<BoardPosition> possibleDestinations = new ArrayList<BoardPosition>();
if (board.pieces[targetPosition.getColumn()][targetPosition.getRow()] != null) {
if (board.pieces[targetPosition.getColumn()][... | 4 |
private void createNewPath() {
JTextField edgeName = new JTextField(20);
JTextField edgeWeight = new JTextField(20);
JPanel newEdgePanel;
newEdgePanel = new JPanel(new GridLayout(3,1,5,2));
newEdgePanel.add(new JLabel("Vad ska förbindelsen heta?"));
newEdgePanel.add(edgeN... | 5 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass()) {
if (obj.getClass() == String.class) {
return name.equals((String) obj);
}
return false;
}
Variable other = (Variable) obj;
if (name == null) {
... | 7 |
public Tile tile(int x, int y) {
if (x < 0 || x >= width || y < 0 || y >= height) {
return Tile.OOB;
} else {
return tiles[x][y];
}
} | 4 |
public MeanFilterDialog(final Panel panel) {
setTitle("Mean filter");
setBounds(1, 1, 250, 140);
Dimension size = getToolkit().getScreenSize();
setLocation(size.width / 3 - getWidth() / 3, size.height / 3
- getHeight() / 3);
this.setResizable(false);
setLayout(null);
JPanel pan = new JPanel();
pan.... | 2 |
public void update(GameContainer gc, StateBasedGame sbg, GameplayState gs, int delta) {
for (Entry<Long, Enemy> enemy : this.enemies.entrySet()) {
enemy.getValue().update(gc, sbg, gs, delta);
if (enemy.getValue().isDead()) {
this.toBeRemoved.add(enemy.getKey());
}
else
... | 4 |
@Override
public boolean canMove(Board board, Field currentField, Field emptyField) {
return this.validSetupForMove(currentField, emptyField) && board.clearPathBetween(currentField, emptyField);
} | 1 |
private static AbstractResultSet doVoting(
AbstractResultSet[] secondaryResSets, Match matchCriterion,
boolean typeChecking, int voteThreshhold) throws FileNotFoundException {
AbstractResultSet res = new EnsembleResultSet();
res.docNumber = secondaryResSets[0].docNumber;
String resType = "";
... | 8 |
private void create(Color bg, Animation init, String fieldTitle) {
setPreferredSize(new Dimension(GUIConstants.DEFAULT_FIELD_WIDTH, FIELDHEIGHT));
setBackground(bg);
setLayout(new VerticalLayout(5, VerticalLayout.CENTER));
setBorder(BorderFactory.createTitledBorder(fieldTitle));
... | 5 |
private Token scanTag() {
// See the specification for details.
Mark startMark = reader.getMark();
char ch = reader.peek(1);
String handle = null;
String suffix = null;
if (ch == '<') {
reader.forward(2);
suffix = scanTagUri("tag", startMark);
... | 7 |
public List<String> readActiveDates() {
List<String> retList = new ArrayList<String>();
try {
ResultSet rs = _sqLite.query("SELECT DISTINCT date(time_login) AS dt FROM login;");
while (rs.next()) {
try {
String tmpStr = rs.getString("dt");
retList.add(tmpStr);
} catch (SQLException e) {
... | 3 |
@Override
protected void onTextMessage(CharBuffer text) throws IOException {
Message message = new Message(text.toString());
RoboBase robo_base = RoboBase.getInstance();
String status;
switch (message.getCommand()) {
case LOGIN:
status = robo_base.isOnline(message.getRobotName()) ? "ok" : "error: offlin... | 4 |
public void start(){
setSize(300, 300);
setTitle("Serial Port Manager");
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
SerialDevices[] devices = SerialDevices.values();
HashMap<String, String> content = PortList.readFromFile(PortList.FILE_LOCATION);
for(SerialDevices device: devices){
if(device != Ser... | 7 |
public void start() {
// TODO Auto-generated method stub
Socket socket = null;
try {
socket = new Socket("127.0.0.1",6116);
} catch (UnknownHostException e) {
logger.log(Level.WARNING,"Can't connect", e);
} catch (IOException e) {
logger.log(Level.WARNING,"Can't io", e);
return;
}
if(socket ==... | 9 |
public static void main(String[] args) {
String keyPass = "fanjun" ;
InputStream inputStream = CertificateSignatureMain.class.getResourceAsStream("rsa.jks");
InputStream inStream = CertificateSignatureMain.class.getResourceAsStream("rsa.cer");
try {
KeyGenerator kg = KeyGenerator.getInstance("AES");
k... | 9 |
public static int getRotatedMapChunkX(int rotation, int y, int x) {
rotation &= 3;
if (rotation == 0) {
return x;
}
if (rotation == 1) {
return y;
}
if (rotation == 2) {
return 7 - x;
} else {
return 7 - y;
}
} | 3 |
public void update() throws IOException {
// update player
player.update();
tileMap.setPosition(
GamePanel.WIDTH / 2 - player.getx(),
GamePanel.HEIGHT / 2 - player.gety()
);
// set background
bg.setPosition(tileMap.getx(), tileMap.gety());
// attack enemies
player.checkAttack(enemies);
... | 4 |
public String variableForState(State state) {
return (String) MAP.get(state);
} | 0 |
public String toTreeString( int depth ) {
StringBuilder result = new StringBuilder();
if (nodeType != NodeType.VALUE) {
result.append(indent(depth));
result.append( nodeType.toString() );
if ( valueToken != null && ( nodeType == NodeType.EXPRESSION || nodeType == Nod... | 7 |
public static void start(File fileName) {
if(fileName==null)
return;
InstrumentReplacer replace = new InstrumentReplacer();
putInstruments();
try {
Scanner file = new Scanner(fileName);
String songText = file.nextLine();
replace.setParams... | 9 |
public synchronized void InsertContent(String list_name, String content, int article_id) {
try {
content_ste.executeUpdate("INSERT INTO zhangyu_sca.article_content (article_id , list_name, list_content) values ( '" + article_id + "' , '" + list_name + "' , '" + content + "');");
} catch (E... | 1 |
public void scanThrough(int numTiles) {
for (int n = 0 ; n < numTiles ;) {
final int scanX, scanY ;
if (scan == 0) {
scanX = scanY = 0 ;
initSeeds() ;
}
else {
scan = lfsr.nextVal() ;
scanX = scan / size ;
scanY = scan % size ;
if (scan == seed... | 5 |
public JScrollPane createTree() {
DefaultMutableTreeNode top = new DefaultMutableTreeNode(getString("TreeDemo.music"));
DefaultMutableTreeNode catagory = null ;
DefaultMutableTreeNode artist = null;
DefaultMutableTreeNode record = null;
// open tree data
URL url = getCla... | 9 |
private void itmMnuRelatorioProjetoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itmMnuRelatorioProjetoActionPerformed
if (usuarioLogado.getTipo().equals("Gerente") || usuarioLogado.getTipo().equals("Diretor")) {
ProjetoBO projetoBO = new ProjetoBO();
//chamar o rel... | 4 |
public static boolean isWorkingDay(DayOfWeek day){
switch(day){
case MONDAY:
case TUESDAY:
case WEDNESDAY:
case THURSDAY:
case FRIDAY:
return true;
case SUNDAY:
case SATURDAY:
return false;
}
return false;
} | 7 |
private JLabel getLbEstado() {
if (lbEstado == null) {
lbEstado = new JLabel("Estado:");
}
return lbEstado;
} | 1 |
private boolean isHorizontalWin(int player) throws Exception {
boolean result = false;
if ((player < 0) || (player > TicTacToeBoard.PLAYER_O)) {
throw new Exception("Invalid player index -- must be 0 or 1");
}
String playerSymbol;
if( player == PLAYER_X) {
playerSymbol = X;
} else {
playerSymbol = ... | 7 |
public Activator() {
} | 0 |
public static void loadSmsBase(){
ImD=new ImportDriver(getConfigDirectoryPath(), "", "");
if(ImD.verifyConnection()){
System.out.println("Connected to database fontlineSms");
try{
rs=ImD.executer("SELECT * FROM message");
if(rs !=null){
while(rs.next()){
System.... | 9 |
private void collision(LinkedList<GameObject> object) {
for (int i = 0; i < handler.objects.size(); i++) {
GameObject tempObject = handler.objects.get(i);
switch (tempObject.getID()) {
case Block:
if (getBoundsTop().intersects(tempObject.getBounds())) {
y = tempObject.getY() + tempObject.getHeigh... | 6 |
void table3(){
int startNumber = 2;
StringBuilder currentLine = new StringBuilder();
do{
for (int secondMultNumber = 1; secondMultNumber <= 10; secondMultNumber++) {
for (int firstMultNumber = startNumber; firstMultNumber < startNumber + 4; firstMultNumber++) {
... | 3 |
public CheckResultMessage checkG(int day) {
BigDecimal g = new BigDecimal(0);
int row1 = get(10, 2);
int clums1 = get(11, 2);
int total1 = get(13, 2);
if (version.equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
for (int i = row1; i < total1; i++) {
... | 7 |
public static double angle2DBetween(double[] coord1, double[] coord2)
{
if (coord1.length != coord2.length && coord1.length != 2)
throw new IllegalArgumentException (
"Number of dimensions is not valid for the provided coordinates");
double xDiff = coord2[0] - coord1[0];
double yDiff = coord2[1] - coo... | 2 |
@Test
public void testMeilleurParcour()
{
Random rand = Mockito.mock(Random.class);
LandSensor sensor = new LandSensor(rand);
// On crée un chemin de terre.
Mockito.when(rand.nextInt(Land.CountLand())).thenReturn(0);
try {
sensor.getPointToPointEnergyCoeffic... | 3 |
private CycAccess establishAndVerifyCycAccess(final String hostname, final String port)
throws UnknownHostException, IOException, CycApiException {
final StringBuffer hostnamePortBuffer = new StringBuffer();
hostnamePortBuffer.append(hostname);
hostnamePortBuffer.append("/");
hostnamePortBuffer.app... | 5 |
private boolean korjaaSijainti()
{
ArrayList<Suunta> suunnat = paivitaTormaystarkistus().suunnat();
if(suunnat.isEmpty())
return true;
else if(suunnat.contains(Suunta.OIKEA))
return yritaPoistuaTormaamasta(Suunta.VASEN);
else if(suunnat.contains(Suunta.VASEN)... | 3 |
@Override
public List<NepticalData> getAllData() {
if (fragments.isEmpty()) {
return new ArrayList<>();
}
return getDataModule(fragments.get(fragments.size() - 1)).getAllData();
} | 1 |
public synchronized void start(){
if(running)
return;
running = true;
thread = new Thread(this);
thread.start();
} | 1 |
public void loadHeader(BufferedReader bin) throws MaltChainedException {
String fileLine = "";
Pattern tabPattern = Pattern.compile("\t");
try {
while ((fileLine = bin.readLine()) != null) {
if (fileLine.length() == 0 || fileLine.charAt(0) != '\t') {
break;
}
String items[];
try {
ite... | 7 |
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 Vector2f rectCollide(Vector2f oldPos, Vector2f newPos, Vector2f size1,
Vector2f pos2, Vector2f size2){
Vector2f res = new Vector2f(0, 0);
if(newPos.getX() + size1.getX() < pos2.getX() ||
newPos.getX() - size1.getX() > pos2.getX() + size2.getX() * size... | 8 |
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Type)) {
return false;
}
Type t = (Type) o;
if (sort != t.sort) {
return false;
}
if (sort >= ARRAY) {
... | 7 |
public void Afficher()
{
String res = "";
for (int i = 0; i < this.hauteur; i++)
{ // Parcours le premier tableau
for (int j = 0; j < this.largeur; j++)
{ // Parcours le second tableau
switch (this.background[i][j])
{
case MUR : res = res +"M"; break;
case HERBE : res = res +... | 9 |
@Override
public Iterable<ImmutableToken> tokenizeDocument( String document
, Set<String> stopwords
)
{
PorterStemmer stemmer = new PorterStemmer();
int index = 0;
Matcher whitespaceMatcher = null;
List<ImmutableToken> tokens = new ArrayList<ImmutableToken>();
while(document !=null... | 8 |
public void mouseReleased(MouseEvent e) {
if (documentViewModel.getViewToolMode() ==
DocumentViewModel.DISPLAY_TOOL_TEXT_SELECTION) {
textSelectionHandler.mouseReleased(e);
} else if (documentViewModel.getViewToolMode() ==
DocumentViewModel.DISPLAY_TOOL_SELECT... | 3 |
public void draw(Graphics2D g) {
bg.draw(g);
tileMap.draw(g);
player.draw(g);
for (int i = 0; i < enemys.size(); i++)
((Enemy) enemys.get(i)).draw(g);
teleport.draw(g);
for (int i = 0; i < explosions.size(); i++) {
((Explosion) explosions.get(i)).setMapPosition(
(int) tileMap.getx(), (int) tileMa... | 3 |
@EventHandler(priority = EventPriority.MONITOR)
public void onEnchant(EnchantItemEvent event){
Player player = (Player)event.getEnchanter();
String playername = player.getName();
World world = player.getWorld();
Boolean staff = false;
String worldname = world.getName();
Map<Enchantment, Integer> ench = e... | 4 |
public static void main(String[] args) {
String[] hostNames = initializeHostNames();
// Parse the parameters (fill gaps with defaults):
Alloy alloy = parseInput(args, hostNames);
// Run stuff:
buildAndRunGui(alloy, hostNames);
alloy.runSimulation();
... | 0 |
public boolean reserveSeat(int theaterId, int line, int column){
if(line == -1 || column == -1)
return false;
TheaterSeats seats = TheaterSeatsCatalog.getTheaterSeats(theaterId);
//if it isn't on cache, then we must seek on the disk
if(seats == null){
seats = loadSeatsFromDisk(new File(workingDir + Fi... | 6 |
final void method1716(boolean bool) {
anInt6050++;
if (bool != false)
method1714(-51, -128);
if (((Class348_Sub51) ((Class239) this).aClass348_Sub51_3136)
.aClass239_Sub25_7271.method1830((byte) -123)
&& !Node.method2714(7351,
((Class348_Sub51)
((Class239) this).aClass348_Sub51_3136)
... | 5 |
public void save(ConnectionWrapper cw, String subClassName, Long realId) throws SQLException
{
// store a reference to the subclass table entry
Integer subClassNameId = adapter.getPersist().getClassNameNumberMap().getNumber(cw, subClassName);
addValueTrio(Defaults.REAL_CLASS_COL, subClassNameId, Integer.class);
... | 6 |
public FuzzyTermsEnum(Terms terms, AttributeSource atts, Term term,
final float minSimilarity, final int prefixLength, boolean transpositions) throws IOException {
if (minSimilarity >= 1.0f && minSimilarity != (int)minSimilarity)
throw new IllegalArgumentException("fractional edit distances are not all... | 9 |
private void lockOnReportDir(File reportDir) {
synchronized (files) {
while (files.contains(reportDir))
try {
files.wait();
} catch (InterruptedException ex) {
logger.log(SEVERE, Thread.currentThread().getName() +" INTERRUPTED",... | 2 |
public void templateMethod() {
System.out.println("前処理:" + LoggerUtils.getSig());
// 独自処理はサブクラスで実装
method();
System.out.println("後処理:" + LoggerUtils.getSig());
} | 0 |
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.