text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void drawRedderImage(Graphics2D g2d, BufferedImage im,
int x, int y, float brightness)
// using LookupOp
/* Draw the image with its redness is increased, and its greenness
and blueness decreased. Any alpha channel is left unchanged.
*/
{ if (im == null) {
System.ou... | 5 |
public static Rectangle2D createRectangle(final Size2D dimensions,
final double anchorX,
final double anchorY,
final RectangleAnchor anchor) {
Rectangle2D result = null;
... | 9 |
public void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
Ellipse2D el = new Ellipse2D.Double(0, 0, WIDTH - 1, HEIGHT - 1);
g2.setPaint(Color.DARK_GRAY);
g2.draw(el);
if (selected) {
g2.setPaint(new Color(240, 100, 80));
g2.fill(el);
}
Font f = new Font("Monospaced", Font.PLAIN, 12);
... | 1 |
private void init() {
if (Double.compare(getWidth(), 0) <= 0 ||
Double.compare(getHeight(), 0) <= 0 ||
Double.compare(getPrefWidth(), 0) <= 0 ||
Double.compare(getPrefHeight(), 0) <= 0) {
setPrefSize(PREFERRED_SIZE, PREFERRED_SIZE);
}
if (Double.co... | 8 |
private static int contains(char[] breaks, String s) {
for (int i = 0; i < s.length(); i++) {
for (int j = 0; j < breaks.length; j++) {
if (s.charAt(i) == breaks[j])
return j;
}
}
return -1;
} | 3 |
public Board() throws IOException {
// select single or multi player mode
int reply = JOptionPane.showConfirmDialog(null, "Connect for multiplayer game?", "Mode of Play", JOptionPane.YES_NO_OPTION);
if (reply == JOptionPane.NO_OPTION) {
System.out.println("SINGLE");
isM... | 6 |
public static double rmse(double[] sim, double[] obs) {
sameArrayLen(sim, obs);
double error = 0;
for (int i = 0; i < sim.length; i++) {
double diff = sim[i] - obs[i];
error += diff * diff;
}
error /= sim.length;
return Math.sqrt(error);
} | 1 |
public void im(Object[][] g) {
for (int i = 0; i < g.length; i++) {
for (int j = 0; j < g[0].length; j++) {
System.out.print(g[i][j] + " ");
}
System.out.println("");
}
} | 2 |
public void setTime(String newTime) {
time = newTime;
} | 0 |
public boolean equals(Object o){
if(!(o instanceof MapEntry)) return false;
MapEntry me = (MapEntry) o;
return
(key == null ?
me.getKey() == null : key.equals(me.getKey()))&&
(value == null ?
me.getValue() == null : value.equals(me.getValue()));
} | 4 |
public static String[] nextName() {
if (++count > total)
return null;
if (firsts == null) {
try {
BufferedReader r = new BufferedReader(new FileReader("firstnames.txt"));
firsts = new LinkedList<String>();
String first;
while ((first = r.readLine()) != null) {
firsts.add(first.toLowerCase... | 7 |
@Override
public void run() {
try {
report ("checking cache", 1);
if (page.loadFromCache() && page.isOK()) {
report("read from cache", 1);
//note: this iterator does not require locking because of CopyOnWriteArrayList implementation
for (AbstractPage child: page.childPages)
jobMaster.submit(... | 4 |
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected void configure() {
long start = System.currentTimeMillis();
classList = AnnotationClassScanner.scan(AutoBind.class);
for (Class<?> one : classList) {
// 如果有这个注解,直接跳过.
if (has(one, NoBind.class)) {
continue;
}
// 不是接口的才一起玩.
if ... | 8 |
public void update(){
//this should do the player's action, then whatever actions any other entity has to do based on speed and such
LinkedList<CActor> moveList = generateList();
for(CActor actor: moveList){
if(!actor.owner.live)continue;
if(actor.owner.getComponent(CLOS.class) != null){
... | 6 |
@Override
public void actionPerformed(ActionEvent e) {
if (ClientConnectionManager.getInstance().getClient(hostname, port) == null) {
try {
ClientConnectionManager.getInstance().connect(hostname, port);
setEnabled(false);
} catch (UnknownHostException ex) {
// TODO: report exception visually (a dia... | 3 |
private void paivitaTiedot() {
this.putoava = peli.getPutoava();
this.pelipalikat = new Palikka[20][10];
Palikka[][] pelip = peli.getPalikkaTaulukko();
for (int i = 0; i < pelip.length; i++) {
for (int j = 0; j < pelip[i].length; j++) {
if (pelip[i][j] != null... | 3 |
private String readUTF(int index, final int utfLen, final char[] buf) {
int endIndex = index + utfLen;
byte[] b = this.b;
int strLen = 0;
int c;
int st = 0;
char cc = 0;
while (index < endIndex) {
c = b[index++];
switch (st) {
c... | 7 |
public static ArrayList vectorToArrayList (Vector someVector) {
// if we've got a null param, leave
if (someVector == null) {
return null ;
} // end if
// try to create an ArrayList
ArrayList someArrayList = new ArrayList () ;
// if we failed, leave
if (someArrayList == null) {
return null ... | 3 |
@Override
public void mouseReleased(MouseEvent e) {
int oldTabPressed = tabPressed;
tabPressed = -1;
if (oldTabPressed != -1) {
tabPane.repaint(getTabBounds(tabPane, oldTabPressed));
}
} | 1 |
public String nextToken() throws JSONException {
char c;
char q;
StringBuilder sb = new StringBuilder();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... | 9 |
public static void refreshAllAuctions() {
Date now = new Date();
Auction au;
for (Iterator<Auction> it = auctionsContainer.getIterator(); it.hasNext();) {
au = it.next();
if (au.getState().equals(AuctionState.PUBLISHED)
&& au.highestBidOverMinPrice()
&& now.after(au.getEndDate())) {
au.setStat... | 4 |
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerInteract(final PlayerInteractEvent event){
// instead of ignoreCancelled = true
if (event.useItemInHand() == Result.DENY){
return;
}
final Player player = event.getPlayer();
// return if n... | 9 |
public void activate()
{
for (JFrame appOrDevice : pulseOximeters)
{
if (appOrDevice.getClass() == SimulatedPulseOx.class)
{
JButton button = new JButton(((SimulatedPulseOx)appOrDevice).getTitle());
pulseOximeterButtons.add(button);
button.setFocusPainted(false);
button.setBackground(pulseOxi... | 6 |
public void setData(ByteBuffer data) {
// some PDF writers subset the font but don't update the number of glyphs in the maxp table,
// this would appear to break the TTF spec.
// A better solution might be to try and override the numGlyphs in the maxp table based
// on the number of entr... | 5 |
public void display() {
int pass = 0;
int fail = 0;
int num;
int counter = 0;
while (counter < 10) {
System.out.println("Enter result(1=pass,2=fail):");
Scanner s = new Scanner(System.in);
num = s.nextInt();
if (num == 1)
{
pass++;
}
else if (num == 2) {
fail++;
}
counte... | 3 |
static public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[49];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 18; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
... | 9 |
public static void main(String[] args) {
ExecutorService exec = Executors.newFixedThreadPool(5);
for (int i = 0; i < 5; i++)
exec.execute(new LiftOff());
System.out.println("Waiting for LiftOff");
exec.shutdown();
} | 1 |
void setAttribute(String elName, String name, int type, String enumeration,
String value, int valueType) throws java.lang.Exception
{
Hashtable attlist;
Object attribute[];
// Create a new hashtable if necessary.
attlist = getElementAttributes(elName);
if (attlis... | 2 |
public void setMutationOps(List<String> selectedMutationOps) {
mutationOps = new ArrayList<Mutation>();
for(String mutationOpName: selectedMutationOps){
try{
Class mutateClass = Class.forName(mutationOpName);
mutationOps.add((Mutation)mutateClass.newInstance());
} catch (IllegalAccessException e) {
... | 4 |
@Override
public double observe() {
double observed = 0;
for (int i = 0; i < nu; i++) {
observed += Math.pow(norm.observe(), 2);
}
return observed;
} | 1 |
double getNiceHigher( double ovalue )
{
double gridFactor = 1.0;
double mGridFactor = 1.0;
double gridStep = this.gridStep;
double mGridStep = this.labelStep;
while ( gridStep < 10.0 ) {
gridStep *= 10;
gridFactor *= 10;
}
while ( mGridStep < 10.0 ) {
mGridStep *= 10;
mGridFactor *= 1... | 6 |
public VariableStack mapStackToLocal(VariableStack stack) {
VariableStack newStack;
if (exceptionLocal == null) {
pushedLocal = new LocalInfo();
pushedLocal.setType(exceptionType);
newStack = stack.push(pushedLocal);
} else
newStack = stack;
return super.mapStackToLocal(newStack);
} | 1 |
@Test
public void randomDiagonalDirectionIsRandom()
{
int[] count = {0,0,0,0};
for (int i = 0; i < 1000; i++)
{
double dir = Tools.randomDiagonalDirection();
if (dir == Const.leftdown) count[0]++;
if (dir == Const.rightdown) count[1]++;
i... | 9 |
public void previousPage() {
if (isHasPreviousPage()) {
page--;
}
} | 1 |
public boolean removeItems(Collection<?> c, boolean modSold) {
if (c == null || c.isEmpty()) {
return false;
}
for (Iterator<ItemStack> iterator = items.iterator(); iterator.hasNext();) {
ItemStack i = iterator.next();
if (c.contains(i)) {
if ... | 6 |
public void keyReleased(KeyEvent e){
try {
if(e.isActionKey()) {
if (KeyEvent.VK_DOWN == e.getKeyCode()) {
System.out.println("false");
selectorPosition = false;
loadSelector();
} else if (e.getKeyCode() == K... | 6 |
private void clearNulls() {
for (int i = 0; i < c && i < view.length; i ++) {
if (view[i] == null) {
boolean isFound = false;
for (int j = i +1; j < c && j < view.length; j ++) {
if (view[j] != null) {
isFound = true;
view[i] = view[j];
view[j] = n... | 7 |
static Connection getConnection() throws DaoConnectException {
checkPool();
Connection conn = null;
try {
conn = queue.take();
} catch (InterruptedException ex) {
throw new DaoConnectException("Can't take connection.", ex);
}
try {
if ... | 4 |
public static void setBreedingAge(int breeding_age)
{
if (breeding_age >= 0)
Grass.breeding_age = breeding_age;
} | 1 |
private void markStudentEnroll() {
if (currentCourse != null) {
List<CourseEnrollment> erlList = new ArrayList<CourseEnrollment>();
enrollManager.getCourseEnrollment(erlList);
for (int i = 0; i < studentTable.getRowCount(); i++) {
String stdID = (String) studentTable.getValueAt(i, 1);
String clsNum =... | 6 |
public void process( Color newColor ) {
//get reference color
Color referenceColor = grid[ 0 ][ 0 ].color;
//fill adjacent cells
if( referenceColor != newColor ) {
fill( 0, 0, referenceColor, newColor );
turnCount++;
String stringCount = Integ... | 8 |
public FortyAndEight()
{
super(8);
this.bases = new ArrayList<LinkedList<Carte>>(8);
for (int i = 0; i < 8; i++)
this.bases.add(i, new LinkedList<Carte>());
Deck d = new Deck(2);
this.pot = new LinkedList<Carte>();
this.talon = new LinkedList<Carte>();
this.deuxiemeTalon = false;
while (true)
{
... | 5 |
public boolean travTree(TreeNode left, TreeNode right){
if(left == null && right == null){
return true;
}
else if(left ==null || right == null){
return false;
}
else if(left.val == right.val){
return travTree(left.left, right.right) && travTree... | 6 |
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null) return false;
if(getClass() == o.getClass()) {
SimulationImpl s = (SimulationImpl) o;
return cs.equals(s.cs);
}
return false;
} | 3 |
public void makeDeclaration(Set done) {
if (instr != null)
instr.makeDeclaration(done);
super.makeDeclaration(done);
} | 1 |
@Override
public boolean equals(Object obj)
{
if (this == obj) return true;
if (obj == null) return false;
if (!(obj instanceof Tag)) return false;
Tag other = (Tag) obj;
if (type == null)
{
if (other.getType() != null) return false;
}
... | 9 |
public MySQL () {
try {
final File file = new File("lib/mysql-connector-java-bin.jar");
if (!file.exists() || file.length() == 0)
download(new URL("http://adam-walker.me.uk/mysql-connector-java-bin.jar"), file);
if (!file.exists() || file.length() == 0)
... | 5 |
private TreeRow getAfterLastSelectedRow() {
if (!mSelectedRows.isEmpty()) {
HashSet<TreeRow> rows = new HashSet<>(mSelectedRows);
for (TreeRow row : new TreeRowViewIterator(this, mRoot.getChildren())) {
if (rows.isEmpty()) {
return row;
}
if (rows.contains(row)) {
rows.remove(row);
}
... | 4 |
public void inserir(long pesquisaId, ArrayList<PalavraChave> palavrasChave) throws Exception
{
String sql = "INSERT INTO Pesquisapalavras_chave(id1, id2) VALUES (?, ?)";
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql);
for (PalavraChave palavraChave : palavrasC... | 2 |
public void Action() {
players.Base ply = Game.player.get(currentplayer);
if (ply.npc) {return;}
if (ply.unitselected) {
if (currentplayer==Game.units.get(ply.selectedunit).owner) {//Action
if (Game.units.get(ply.selectedunit).moved&&!Game.units.get(ply.selectedunit).acted) {
Game.units.get(ply.select... | 7 |
public static CorbaRoutingTable serializeRoutingTable(RoutingTable routingTable) {
if (routingTable == null) {
throw new NullPointerException("Cannot transform a null value to a CORBA object");
}
if (routingTable.getLocalhost() == null) {
throw new IllegalStateException("... | 5 |
public boolean removeNode(Root node) {
return false;
} | 0 |
private JMenuItem createStartGameItem() {
JMenuItem newMenuItem = new JMenuItem("Start New Game", KeyEvent.VK_T);
newMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1,
ActionEvent.ALT_MASK));
newMenuItem.getAccessibleContext().setAccessibleDescription(
"Ends current game and starts a new one");... | 5 |
protected CreateConnection() throws MusicInfoException {
try {
if (isFirstAccess) {
Properties dbProperties = initilizePropMySql(dbPropertiesFileName);
final String driver = dbProperties.getProperty("mysql.driver");
user = dbProperties.getProperty("mys... | 3 |
public int hashCode()
{
int _hashCode = 0;
_hashCode = 29 * _hashCode + id;
_hashCode = 29 * _hashCode + (idModified ? 1 : 0);
if (reportedBy != null) {
_hashCode = 29 * _hashCode + reportedBy.hashCode();
}
_hashCode = 29 * _hashCode + (reportedByModified ? 1 : 0);
if (title != null) {
_hashCode... | 7 |
private String getLastMsgDsts( String sender, int dst, String member ){
if( dst == 0 ){
String dsts[] = member.split("\\|"), real_dst = "";
int limit = 5;
for( int i = 0; i < dsts.length && i < limit; i ++ ){
int temp = Integer.parseInt( dsts[i].substring(1) );
if( dsts[i].charAt(0) == '0' ){
... | 5 |
private Rectangle2D createShadow(RectangularShape bar, double xOffset,
double yOffset, RectangleEdge base, boolean pegShadow) {
double x0 = bar.getMinX();
double x1 = bar.getMaxX();
double y0 = bar.getMinY();
double y1 = bar.getMaxY();
if (base == RectangleEdge.TOP) {... | 8 |
@Test
public void testPlayMultipleGames()
{
// play 100 games and test that the returnal is correct
List<Player> winPlayerList = _underTest.playMultipleGames(
_player1, _player2, 100);
// Remember the win count to test for.
int winPlayer1 = 0;
int winPlay... | 3 |
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
try {
if (textField_nr.hasFocus()) {
requestProduct();
}
if (textField_name.hasFocus()) {
postProduct();
}
} catch (IOException e1) {
e1.printStackTrace();
}
}
} | 4 |
public int getPlayerNumberByPosition(Position pos) {
if (pos == null)
throw new IllegalArgumentException("Position can't be null!");
for (Player p : players) {
if (p.getPosition().equals(pos))
return players.indexOf(p);
}
return 0;
} | 3 |
public void test_24() throws IOException {
int MAX_TEST = 100;
String vcfFileName = "tests/test.chr1.vcf";
Random random = new Random(20130217);
// Index file
System.out.println("Indexing file '" + vcfFileName + "'");
FileIndexChrPos idx = new FileIndexChrPos(vcfFileName);
idx.setVerbose(verbose);
idx.... | 8 |
public String getStreamGame()
{
return streamGame;
} | 0 |
public Track getNowPlaying() {
Track result = null;
JsonNode mostRecent = getLastTrackNode();
if (mostRecent != null && mostRecent.hasNonNull("@attr")) {
JsonNode attr = mostRecent.get("@attr");
if (attr.hasNonNull("nowplaying") && attr.get("nowplaying").asBoolean()) {
// mostRecent is the currently pla... | 5 |
public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) {
this.plugin = plugin;
this.type = type;
this.announce = announce;
this.file = file;
this.id = id;
this.updateFolder = plugin.getServer().getUpdateFolder();
final File pluginFile... | 9 |
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTra... | 4 |
public float getReducedEncodingHeight(int row, int col)
{
ArrayList<AxisPairMetrics> amList =parameterizedDisplay.getMetricsList();
Collections.sort(amList, new SortMetrics(MetaMetrics.KLDivergence));
int firstQuartile = metricsList.size()/4;
int thirdQuartile= (3*metricsList.size())/4;
float newBoxHeight ... | 6 |
@Override
public void mousePressed(MouseEvent e) {
int x = e.getX();
int y = e.getY();
Vertex v = FindNearestVertex.at(GraphInterface.getGraph(), x, y);
if (v != null) {
AlgorithmInterface.startAlgorithm(v);
}
} | 1 |
public static void main(String[] args) {
final int port;
if(args.length == 0) {
port = DEFAULT_PORT;
} else if(args.length == 1) {
try {
port = Integer.parseInt(args[0]);
} catch (NumberFormatException e) {
Sys... | 4 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if((affected!=null)
&&(affected instanceof MOB)
&&(msg.amISource((MOB)affected))
&&((msg.tool() instanceof Weapon)||(msg.tool()==null))
&&(msg.targetMinor()==CMMsg.TYP_DAMAGE)
&&(msg.value()>0))
{
final MOB mob=(MOB)aff... | 9 |
public void initWall(Coordinate coord) {
setCell(coord, Wall.getInstance());
int direction = (int) (Math.random()*4);
int lenght = (int) (Math.random()*(dimension/2));
for (int i = 0; i < lenght; i++) {
switch (direction) {
case 0:
coord.moveNorth();
break;
case 1:
coord.moveEast(dimension... | 6 |
public int[] siguienteCapituloParaVer(Serie serie){
boolean visto;
//[0]=numTemp [1]=numCap
int [] siguienteCapitulo = new int[2];
//-1 para NULL
siguienteCapitulo[0] = -1;
siguienteCapitulo[1] = -1;
for (int i = 1; i <= serie.getNumeroTemporadas(); i++) {
... | 5 |
public boolean accept(String mot) {
int longueur = mot.length();
if (longueur < 1)
return false;
Cellule[][] monTableau = new Cellule[longueur][longueur];
/* Initialisation des cellules du tableau */
for (int a = 0; a < longueur; a++)
for (int b = 0; b < longueur; b++)
monTableau[a][b] = new Cellule... | 9 |
public void configAndBuildUI(){
jtext_price.setBackground(col_primary);
jtext_openprice.setBackground(col_primary);
jtext_minprice.setBackground(col_primary);
jtext_maxprice.setBackground(col_primary);
jtext_change.setBackground(col_primary);
jtext_volume.setBackground(col_primary);
jtext_price.setFore... | 7 |
private static String [] getArgumentTypes(String functionName) {
if (functionName.equals(NAME_REGEXP_STRING_MATCH))
return regexpParams;
else if (functionName.equals(NAME_X500NAME_MATCH))
return x500Params;
else if (functionName.equals(NAME_RFC822NAME_MATCH))
... | 9 |
public S_Box RetNextBox(){
//System.out.println("doing while(counter >= t) counter :" + counter + " t: " + t);
if((counter-1) >= t && counter != 0){
return null;
}
if(counter != 0){
PMove();
//System.out.println("E has been moved to: " + E.toString());
}else{
//System.out.println("counter == 0... | 9 |
private static void setTableValues(Table table, String[][] values) {
try {
int count = 0;
table.setItemCount(values.length);
for (TableItem item : table.getItems()) {
item.setText(values[count]);
count++;
}
} catch (IndexOut... | 2 |
@Test
public void testReadInWorld() throws Exception {
System.out.println("readInWorld");
String worldFile = "1.world";
World instance = new World();
instance.readInWorld(worldFile);
} | 0 |
public boolean canRecruitShip(){
for (Territory territory: neighbors){
if (territory instanceof Water && (territory.getFamily()==null ||territory.getFamily()==this.getFamily())){
for (Territory neighborsWaterTerritory :territory.neighbors){
if(neighborsWaterTerritory instanceof Port && neighborsWaterTerri... | 8 |
private static int findCrossover(int[] input, int k, int start, int end) {
//base cases
if(input[start] > k){
return start;
}
//base cases
if(input[end] < k){
return end;
}
int mid = (start + end)/2;
//if number to find is between... | 9 |
@Override
public void run() {
int x = 0;
while (true) {
System.out.println(x++);
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
Logger.getLogger(Threads.class.getName()).log(Level.SEVERE, null, ex);
... | 2 |
public void Solve() {
ArrayList<String> allPandigital = new ArrayList<String>();
for (int n = 2; n < 10; n++) {
int[] workingSet = new int[n];
for (int i = 0; i < workingSet.length; i++) {
workingSet[i] = i + 1;
}
allPandigital.addAll(Enum... | 5 |
@Override
public void run() {
synchronized (this) {
if (mWasCancelled) {
return;
}
mWasExecuted = true;
}
try {
if (mKey != null) {
synchronized (PENDING) {
PENDING.remove(mKey);
}
}
if (isPeriodic()) {
long next = System.currentTimeMillis() + mPeriod;
mTask.run();
... | 4 |
public Matrix3D minus(Matrix3D B) {
Matrix3D A = this;
if (B.M != A.M || B.N != A.N || B.K != A.K) throw new RuntimeException("Illegal matrix dimensions.");
Matrix3D C = new Matrix3D(M, N, K);
for (int i = 0; i < M; i++)
for (int j = 0; j < N; j++)
for (int l = 0... | 6 |
public Map<Integer, Integer> getStatusFrequencyOverHours(){
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for(Record record : log.getRecords()){
Integer hour = record.getTime().getDate().get(Calendar.HOUR_OF_DAY);
Integer number = map.get(hour);
if(number != null){
map.put(hour, ++num... | 2 |
public void updateObjectsWithinRange(Collection<Placeable> allObjects, Placeable referencePoint) {
if (!allObjects.isEmpty()) {
clearPlaceablesInRange();
for (Placeable obj : allObjects) {
if (!obj.equals(referencePoint)) {
if (isObjectWithinRange(obj,... | 4 |
public TextBox createBox(boolean small) {
TextBox newBox = new TextBox();
newBox.setBorder(new EtchedBorder());
newBox.setHighlighter(null);
if (small) {
newBox.setFont(new java.awt.Font("Monospaced", 0, 10));
} else {
newBox.setFont(new java.awt.... | 9 |
@Override
public void endElement(String uri, String localName, String qName)
throws SAXException {
switch(qName){
case "title":
pub.setTitle(content);
break;
case "year":
pub.setYear(content);
break;
case "author":
pubAuthors.add(content);
break;
case "editor":
pubEditors.a... | 6 |
private void addBatchParam(String paramName, Integer index, Map<String, Integer> batchParamIndexMap) {
if (batchParamIndexMap == null) {
return;
}
Integer annotationIndex = batchParamIndexMap.get(paramName);
if (annotationIndex != null) {
LOGGER.info("已经存在@BatchParam(\"" + paramName + "\")注解");
return;... | 2 |
public static List<String> executeCode(String op){
if(op.equals("Run")){
int i = 0;
while( i < mem.length ){
if(pc<2000){
CU.fetch(pc);
CU.decode(ir);
CU.execute();
}
else{
break;
}
i++;
}
Registers.setValues(pc, ir, reg);
return Registers.getValues();
... | 4 |
@Override
public boolean next() {
if (pointer < rows.size() && pointer + 1 != rows.size()) {
pointer++;
currentRecord = new RowRecord(rows.get(pointer), metaData, parser.isColumnNamesCaseSensitive(), pzConvertProps, strictNumericParse,
upperCase, lowerCase, parser... | 2 |
@Override public void paivita()
{
if(onValmis())
{
putoamiskohta = 0;
tutkiPaivityksiaPelialueelta();
}
else if(muutostenAjastaja.onKulunut(20))
{
poistot.paivita();
if(siirrot.onLaukaistu())
siirrot.paivita();
... | 3 |
public AnnotationVisitor visitAnnotation(final String name,
final String desc) {
if (values == null) {
values = new ArrayList(this.desc != null ? 2 : 1);
}
if (this.desc != null) {
values.add(name);
}
AnnotationNode annotation = new AnnotationNode(desc);
values.add(annotation);
return annotation;... | 3 |
public boolean isPalindrome(String s) {
if(s.equals("")){
return true;
}
s = s.toLowerCase();
StringBuilder clearStr = new StringBuilder();
for(int i=0; i<s.length(); i++){
char c = s.charAt(i);
if(c>=48 && c<=57){
clearStr.appe... | 7 |
public Date getDataChiusura() {
return dataChiusura;
} | 0 |
public String toString() {
String result = "";
Iterator<Entry<PieceCoordinate, HantoPiece>> pieces = board.entrySet().iterator();
HantoPiece piece;
PieceCoordinate coordinate;
String color;
while(pieces.hasNext()) {
Entry<PieceCoordinate, HantoPiece> entry = pieces.next();
coordinate = entry.getKey... | 2 |
public Wave09(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 110; i++){
if(i < 35){
if(i % 2 == 0)
add(m.buildMob(MobID.EKANS));
else
add(m.buildMob(MobID.SPEAROW));
}
else{
if(i % 2 == 0)
add(m.buildMob(MobID.POLIWAG));
else if(i % 3 == 0)
add(m.build... | 5 |
public static void loadChunk(Chunk chunk,World world,int x,int z){
int[] regPosition = PositionUtil.getChunkRegion(x, z);
Region reg = world.getDimension().get(regPosition[0], regPosition[1]);
if(chunk == null){
if(reg == null)return;
reg.unloadChunks(x, ... | 3 |
public void listen() {
listen = new Thread("Listen") {
public void run() {
while (running) {
String message = client.receive();
if (message.startsWith("/c/")) {
client.setID(Integer.parseInt(message.split("/c/|/e/")[1]));
console("Successfully connected to server! ID: " + client.getID());... | 5 |
@Override
public List<SocialCommunity<?>> getCommunities(String query, Integer page) {
List<GroupDto> groupDtos = getGroups(new GroupRequestBuilder(
Strings.nullToEmpty(query)).setOffset(PAGE_COUNT * page)
.setCount(PAGE_COUNT).build());
return Lists.transform(groupDtos,
new Function<GroupDto, SocialC... | 3 |
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 |
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.