text stringlengths 14 410k | label int32 0 9 |
|---|---|
static private int jjMoveStringLiteralDfa4_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(2, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(3, active0);
return 4;
}
switch(curChar)
{
cas... | 3 |
public void printMatrix(){
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
switch(matrix[j][i].getState())
{
case defaultState:
System.out.print("[ ] ");
break;
case ... | 7 |
private int tilestrToInt(String tilestr) {
if (tilestr==null) return 0;
switch (tilestr.length()) {
case 0: return 0;
case 1: return (int)tilestr.charAt(0);
case 2: return (int)tilestr.charAt(0)
+ (int)tilestr.charAt(1)*256;
case 3: return (int)tilestr.charAt(0)
+ (int)ti... | 6 |
public void nextPage() {
if (isHasNextPage()) {
page++;
}
} | 1 |
@Override
public Value evaluate(Value... arguments) throws Exception {
// Check the number of argument
if (arguments.length == 1) {
// get Value
Value value = arguments[0];
// If numerical
if (value.getType().isNumeric()) {
return new Value(new Double(Math.log(value.getDouble())));
}
if (val... | 4 |
public static void main(String[] args)
throws IOException, ProcessException
{
String simType = args[args.length - 6];
int linesToRead = Integer.parseInt(args[args.length - 5]);
String inFile = args[args.length - 4];
String uniFile = args[args.length - 3];
Stri... | 6 |
public Pass2(File source, int labelCount) {
labelFile = new File(source.getName() + ".label.tmp"); // File that contains the label information
sourceFile = new File(source.getName() + ".tmp"); // File that holds the cleaned/analyzed source
this.labelCount = labelCount;
labelMap = new HashMap<String, Intege... | 0 |
public static void main(String[] args) throws IOException {
Scanner scan = new Scanner(System.in);
StringBuilder out = new StringBuilder();
precal();
out.append("PERFECTION OUTPUT\n");
while (scan.hasNext()) {
int v = scan.nextInt();
if (v == 0)
break;
out.append(format(v) + " ");
if (v == dp... | 4 |
public void SetPersonNumber(int personNumber)
{
this.personNumber = personNumber;
} | 0 |
@Override
public boolean canSetTrapOn(MOB mob, Physical P)
{
if(!super.canSetTrapOn(mob,P))
return false;
if(mob!=null)
{
final Item I=findMostOfMaterial(mob.location(),RawMaterial.MATERIAL_ROCK);
if((I==null)
||(super.findNumberOfResource(mob.location(),I.material())<100))
{
mob.tell(L("You'... | 8 |
public static boolean isLessPriority(String a, String b){
String[] operadores={a,b};
int[] valores=new int[2];
for (int i = 0; i < operadores.length; i++) {
switch(operadores[i]){
case "^":
valores[i] = -1;
break;
... | 8 |
@SuppressWarnings("RedundantIfStatement")
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SvnInfo svnInfo = (SvnInfo) o;
if (repositoryUrl != null ? !repositoryUrl.equals(svnInfo.repositoryUrl) : svnInfo.repositoryUrl != null)... | 7 |
public void visit_lcmp(final Instruction inst) {
stackHeight -= 4;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} | 1 |
public void paint(Graphics g){
super.paint(g);
Room r = GameController.getRoom();
int rw = r.getSize().width + 2;//room width
int rh = r.getSize().height + 2;// and height
//draw background color
Color c = r.backgroundColor();
if (c != null){
g.setColor(c);
g.fillRect(0, 0, rw, rh);
}
//TODO... | 8 |
public Item sample() {
if (isEmpty())
throw new java.util.NoSuchElementException();
return a[new Random().nextInt(next)];
} | 1 |
private static String prepareSql(String sql, List<String> names) {
logger.info("Prepare sql: " + sql);
String parts[] = sql.split(":");
StringBuilder bld = new StringBuilder();
boolean first = true;
for (String part: parts) {
if (first) {
first = false... | 3 |
@Test
public void testValue() {
System.out.println("value");
for (int i = 0; i < this._values.length; i++)
{
_equals.testValue(_instance, null, _values[i], false);
_equals.testValue(_instance, _values[0], _values[i], false);
_equals.testValue(_instance, _v... | 7 |
private void GuardarEstacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_GuardarEstacionActionPerformed
frecue = miRadio.getFrecuencia();
if (frecue) {
miRadio.Guardar(posFM, a);
posFM++;
} else {
miRadio.Guardar(posAM, b); ... | 3 |
public void setWrapIndices(int[] indices) {
checkWidget();
if (indices == null)
indices = new int[0];
int count = originalItems.length;
for (int i = 0; i < indices.length; i++) {
if (indices[i] < 0 || indices[i] >= count) {
error(SWT.ERROR_INVALID_ARGUMENT);
}
}
for (int i = 0; i < originalItem... | 8 |
public void MainHelpMenu()
{
if(pHead == 0 && pBeard == 10 && pTorso == 18 && pArms == 26 && pLegs == 72 && pFeet == 42 && pHands == 33){
showInterface(3559); // Shows "design your player"-screen if you haven't already designed it.
}
} | 7 |
public float priorityFor(Actor actor) {
if ((! begun()) && nursery.belongs.personnel.assignedTo(this) > 0) {
return 0 ;
}
//
// Vary priority based on competence for the task and how many crops
// actually need attention-
final float min = sumHarvest() > 0 ? ROUTINE : 0 ;
final float... | 4 |
private void createItems() {
HashSet<String> itemPaths;
try {
itemPaths = KvReader.getKvFiles("./items/");
} catch (IOException e){
e.printStackTrace(System.err);
return;
}
for (String s : itemPaths) {
HashMap<String, String> itemAt... | 5 |
@Override
public void run() {
if( getChannels().length == 0 )
joinChannel(channel);
} | 1 |
public void busquedaDesordenada(T dato){
Nodo<T> nodoQ = this.inicio;
while(nodoQ != null && nodoQ.getInfo() != dato){
nodoQ = nodoQ.getLiga();
}
if(nodoQ == null){
System.out.println("El elmento no se encuentra en la lista");
}else{
System.out.println("EL elemento se encuentra en la lista");
}
} | 3 |
public boolean isUrlModified() {
return urlModified;
} | 0 |
public boolean checkAllPortalsFor(MoveableObject object, MazeGame maze) {
for (Portal portal : portals) {
if (portal.intersects(object) && portal.isActive) {
portal.lit = true;
portal.getEndPortal().lit = true;
if (!lights.contains(portal)) lights.add(portal);
if (!lights.contains(portal.getEndPort... | 8 |
boolean isPostingSupported(OMMMsg ommMsg)
{
if (!ommMsg.has(OMMMsg.HAS_ATTRIB_INFO))
return false;
OMMAttribInfo ai = ommMsg.getAttribInfo();
if (!ai.has(OMMAttribInfo.HAS_ATTRIB))
return false;
OMMElementList elementList = (OMMElementList)ai.getAttrib();
... | 7 |
public static ArrayList<String> splitFile() throws IOException{
DataHandler.cleanDir(preprocessFolder);
ArrayList<String> fileList=DataHandler.getFileList(DataHandler.originFolder);
int fileTag=0;
int lineCnt=0;
BufferedReader br = null;
BufferedWriter bw = null;
for(int i=0;i<fileList.size();i++){
Fi... | 6 |
@Override
public void initialize() {
try {
out = new File("src/main/resources/data/hw1-huatang.out");// Path to create my output file.
bw = new BufferedWriter(new FileWriter(out));
} catch (Exception e) {
e.printStackTrace();
}
testfile = new File("src/main/resources/data/sample.ou... | 3 |
public static void main(String[] args) {
@SuppressWarnings("resource")
Scanner scan = new Scanner(System.in);
scan.nextLine();
scan.nextLine();
scan.nextLine();
TreeMap<Integer, TreeMap<String, Double>> exam = new TreeMap<>();
while(true){
String input = scan.nextLine();
if (input.contains("-"... | 5 |
@Override
public void run() {
System.out.println("Listening on port " + this.serversocket.getLocalPort());
ArrayList<String> workerList = new ArrayList<>();
// Read list of workers from configuration file
try(BufferedReader br = new Bu... | 8 |
public ArrayList<Segmento> getSegmentoPorId(String ticket) throws SQLException{
Statement stm = getConnection().createStatement();
String sql = "SELECT * FROM segmentos WHERE ticket='"+ticket+"'";
ArrayList<Segmento> segmentos = new ArrayList();
ResultSet rs = stm.executeQuery(sql);
... | 1 |
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof CmpPoint)) {
return false;
}
CmpPoint o = (CmpPoint) obj;
return this.x==o.x && this.y==o.y;
} | 3 |
public void close() throws IOException {
if (!this.stack.empty()) {
throw new InvalidObjectException("Tags are not all closed. " +
"Possibly, " + this.stack.pop() + " is unclosed. ");
}
if (thisIsWriterOwner)
{
this.writer.flush();
... | 2 |
public void moveLeft() {
setDirection(-90);
for (TetrisBug tb : blocks){
tb.setDirection(-90);
}
if (rotationPos==0){
if (canMove() && blocks.get(0).canMove() && blocks.get(1).canMove() && blocks.get(2).canMove()) {
for (TetrisBug tb: blocks){
tb.move();
}
move();
}
}
if (r... | 9 |
public static void Update()
{
for(int i = 0; i < NUM_KEYCODES; i++)
m_lastKeys[i] = GetKey(i);
for(int i = 0; i < NUM_MOUSEBUTTONS; i++)
m_lastMouse[i] = GetMouse(i);
} | 2 |
protected String getLabel(Tree tree, Node node) {
if (displayAttribute.equalsIgnoreCase(TAXON_NAMES)) {
Taxon taxon = tree.getTaxon(node);
if (taxon != null) {
if (textDecorator != null) {
textDecorator.setItem(taxon);
}
return taxon.getName();
} else {
return "unlabelled";
}
}
i... | 7 |
public boolean canHaveAsBalance(BigInteger balance) {
return (balance != null) && (balance.compareTo(this.getCreditLimit()) >= 0);
} | 1 |
private void markVisitedLinks() {
if (!(textBody.getDocument() instanceof HTMLDocument))
return;
HTMLDocument doc = (HTMLDocument) textBody.getDocument();
ElementIterator i = new ElementIterator(doc);
Element e;
AttributeSet as;
Enumeration en;
Object name;
String str;
SimpleAttributeSet sas;
whi... | 9 |
public static void main(String[] args)
{
JFrame frame = new JFrame("Mandlebrot");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(816, 638);
frame.add(new MandelbrotPanelDouble());
frame.setVisible(true);
// System.out.println(BigDecimal.valueOf(1... | 0 |
public static HashMap<Integer, Integer> backTracking(SchedulingProblem csp, ArrayList<Integer> assignmentCount)
{
if (isComplete(csp))
{
return csp.Assignment;
}
Integer selectedVar;
ArrayList<Integer> mostConstrainedVars = csp.getMostConstrainedMeeting();
if(mostConstrainedVars.size() != 1)
{
s... | 6 |
public static double [] boundLargestEigenValue( DenseMatrix64F A , double []bound ) {
if( A.numRows != A.numCols )
throw new IllegalArgumentException("A must be a square matrix.");
double min = Double.MAX_VALUE;
double max = 0;
int n = A.numRows;
for( int i = 0; i ... | 7 |
private FlagGUI() {
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
Script.stop();
dispose();
}
});
setResizable(false);
setTitle("Flag Viewer");
setBounds(100, 100, 766, 603);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(... | 9 |
public String getJson(String location, String city) {
try {
/*
* Create the query url from template
*/
city = city.replace(" ", "_");
location = location.replace(" ", "_");
String weatherQuery = String.format(QUERY_URL, location, city);
... | 3 |
public Template waitForMatch(Template tpl) {
String queryString = "";
int i = 0;
for (i = 0; i < 9; i++) {
Integer min;
Integer max;
try {
min = (Integer) PropertyUtils.getSimpleProperty(tpl, "property" + i + "_min");
max = (Integer) PropertyUtils.getSimpleProperty(tpl, "property" + i + "_max"... | 7 |
protected Trait(int type, String... descriptors) {
this.traitID = nextID++ ;
this.type = type ;
this.descriptors = descriptors ;
this.descValues = new int[descriptors.length] ;
int zeroIndex = 0, min = 100, max = 0, val ;
for (String s : descriptors) { if (s == null) break ; else zeroIndex+... | 7 |
public void add(int value) {
if (result.size() > 0 && result.getValue((int)result.size() - 1) == value) {
resultGroups.get(resultGroups.size() - 1).maxIteration++;
} else {
resultGroups.add(new ResultGroup((int)result.size(), (int)result.size()));
}
result.add(va... | 2 |
public double getSpawnX(DodgeballPlayer p) {
DodgeballTeam t = p.getTeam();
return t == TEAM_1 ? TEAM_1_SPAWN_X : TEAM_2_SPAWN_X;
} | 1 |
@Override
public void add(User userBean) {
try {
connection = getConnection();
ptmt = connection.prepareStatement("INSERT INTO user(Name, Login, email, DateOfRegistration, password) "
+ "VALUES(?,?,?,?,?);");
ptmt.setString(1, userBean.getName());
... | 5 |
public double evaluate(double x) {
return Math.pow(_base, x);
} | 0 |
public void write(String text)
{
textArea.append(text);
int length = textArea.getText().length();
textArea.setCaretPosition(length);
lastCommandOffset = length;
} | 0 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if((affected!=null)&&(affected instanceof MOB)&&(msg.amISource((MOB)affected)))
{
if((msg.sourceMinor()==CMMsg.TYP_ENTER)
&&(msg.target() instanceof Room)
&&((((Room)msg.t... | 9 |
public void saveToFile() {
try {
FileOutputStream fileOut = new FileOutputStream(FILE);
ObjectOutputStream out = new ObjectOutputStream(fileOut);
out.writeObject(this);
out.close();
fileOut.close();
} catch (IOException e) {
e.printStackTrace();
}
} | 1 |
public void close() throws IOException {
if(r != null) {
r = null;
ogg.close();
ogg = null;
}
if(w != null) {
w.bufferPacket(firstPacket.write(), true);
w.bufferPacket(tags.write(), false);
// TODO Write the others
... | 4 |
public Square(int row, int col, Piece piece)
{
this.row = row;
this.col = col;
this.piece = piece;
y = row * 80;
x = col * 80;
rect = new Rectangle(x, y, 80, 80);
} | 0 |
public PacketManager getPacketManager(){
return packetManager;
} | 0 |
private boolean checkBack(int x, int y, int z){
int dx = x - 1;
if(dx < 0){
return false;
}else if(chunk[dx][y][z] != 0){
return true;
}else{
return false;
}
} | 2 |
private void percolateDown( int hole )
{
int child;
T tmp = array[ hole ];
for( ; hole * 2 <= currentSize; hole = child )
{
child = hole * 2;
if( child != currentSize &&
array[ child + 1 ].compareTo( array[ child ] ) < 0 )
child++;
if( array... | 4 |
public static boolean isSuccessResult(Option[] options){
for(int i=0,count=options.length ; i<count ; ++i){
if((options[i].getName().equals(ActionResult.RESULT)) &&
options[i].getValue().equals(ActionResult.SUCCESS))
return true;
}
return false;
} | 3 |
private void storeUpcommingEarningsPagesCustom() {
try {
long time = System.currentTimeMillis();
for (int i = 0; i < 14; i++) {
Date days = new Date(time + 1000 * 3600 * 24 * i);
String date = dateFormatForUrl.format(days);
String earnings = "http://biz.yahoo.com/research/earncal/"
+ date + ... | 3 |
@Override
public void onEnable() {
logger = new TPLogger(getLogger());
characterManager = new CharacterManager(this);
logger().log(Level.INFO, "Plugin enabled!");
} | 0 |
private void checkDerived(ClassScope subClass, ClassScope classScope)
{
for (Scope method : subClass.methods)
{
if (classScope.hasSymbol(method.getName()))
{
Scope sym = classScope.getSymbol(method.getName());
if (sym instanceof FieldScope)
throw new SemanticError("semantic error at line " + met... | 8 |
@Override
public Boolean isValid() {
constraintViolations = new HashMap<String, String>();
// nom
if (this.nom.isEmpty()) {
constraintViolations.put("NomIsValid", "Le nom est obligatoire.");
} else {
if (this.nom.length() > 50) {
const... | 9 |
@Basic
@Column(name = "PCA_ESTADO")
public String getPcaEstado() {
return pcaEstado;
} | 0 |
public static int calcDistance(String s1, String s2){
if (s1.equals(s2)){
return 0;
}
else{
int n = s1.length();
int m = s2.length();
int e[][] = new int[n+1][m+1];
for (int i=0; i<=n; i++){
e[i][0] = i;
}
for (int j=1; j<=m; j++){
e[0][j] = j;
}
for (int i=1; i<=n; i++){
... | 6 |
public JSONWriter key(String s) throws JSONException {
if (s == null) {
throw new JSONException("Null key.");
}
if (this.mode == 'k') {
try {
if (this.comma) {
this.writer.write(',');
}
stack[top - 1].put... | 4 |
public void updateUser(HttpServletRequest request, HttpServletResponse response,String updateUserinfo) throws ServletException, IOException
{
/*
* Here we initialize tools for making the database connection
* and reading from the database
*/
Connection conn=null;
Statem... | 8 |
public void bake() {
if(pie.getDough().isEmpty()) {
BuilderClient.addOutput("error - no dough found!");
return;
}
if (pie.getFilling().isEmpty()) {
BuilderClient.addOutput("error - no filling found!");
return;
}
baked = true;
BuilderClient.addOutput("*oven sound*");
} | 2 |
public void updateGraphics() {
Tuple<BufferedImage[], Integer> stateSprites = this.animation.getStateSprites(this.state);
BufferedImage[] spriteFrames = stateSprites.getX();
if(disposeAfterAnimation && this.spriteFrame + 1 == spriteFrames.length * stateSprites.getY()) {
disposed = true;
} else {
this.spri... | 2 |
public void step() {
for(int a = 0; a < agents.length; a++) {
agents[a].hasMoved = false;
}
for(int i = 0; i < numStrategies; i++) {
averageScoreStrat[i] = 0;
averageEncountersStrat[i] = 0;
}
for(int a = 0; a < agents.length; a++) {
agents[a].act();
St... | 8 |
@Override
public MouseAdapter thumbnailSelection() {
return new MouseAdapter () {
@Override
public void mouseClicked(MouseEvent event) {
if (selectedEMediumLabel != null)
selectedEMediumLabel.setBorder(null);
selectedEMediumLabel = (EMediumLabel) event.getSource();
selectedEMediumLabel.setB... | 6 |
public void rb_insert(RBNode z) {
RBNode y = nil;
RBNode x = root;
// System.out.println(z.getKey());
while (x != nil) {
y = x;
if (z.getKey() < x.getKey()) {
x = x.getLeft();
} else {
x = x.getRight();
}
... | 4 |
public void actionPerformed(ActionEvent e)
{
if (e.getSource().equals(mPreview))
{
ImageIcon selectedIcon = (ImageIcon) mImageList.getSelectedValue();
String name = selectedIcon.getDescription();
ImageIcon realImage = RHImageLoader.getImageIcon(name);
JDialog jd = new JDialog(this);
jd.getContentPa... | 2 |
public void Solve() {
HashMap<String, List<String>> hashMap = new HashMap<String, List<String>>();
String result = "";
for (int n = 1; n < _max; n++) {
String cube = Cube(n);
String key = SortString(cube);
List<String> cubes = hashMap.get(key);
if... | 5 |
public String getIncompletedSeller() {
Map<String, Object> params = ActionContext.getContext().getParameters();
String seqID = ((String[]) params.get("seqID"))[0];
seller = this.cfService.getIncompletedSeller(seqID);
return SUCCESS;
} | 0 |
public boolean checkPath(String path, boolean isExistingFile) {
File test = new File(path);
if (isExistingFile && !test.isDirectory()) {
return test.exists();
} else {
if (!isExistingFile) {
return test.exists();
}
}
return fals... | 3 |
private void drawBorder(Graphics g)
{
//First initialise colour
Color borderColour = slidePanel.getBackground();
//Set flags (for use in creating the border) for whether the zoomed
//image takes the full height and/or width of the slide area
Boolean isFullWidth = false;
Boolean isFullHeight = false;
if... | 5 |
@Override
public boolean evaluate(T t) {
if(firstSearchString.evaluate(t) || secondSearchString.evaluate(t)){
return true;
}
else{
return false;
}
} | 2 |
private void btnQuitterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitterActionPerformed
((CtrlMenu)controleur).fichierQuitter();
}//GEN-LAST:event_btnQuitterActionPerformed | 0 |
public static void main(String[] args) {
Random rnd = new Random();
for (int step = 0; step < 100_000; step++) {
int n = rnd.nextInt(10) + 1;
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = rnd.nextInt(10);
int k = rnd.nextInt(n);
nth_element(a, 0, n, k);
int[] s = a.clone();
Array... | 8 |
public static void main(String[] args) throws ParserConfigurationException, SAXException,
IOException, NoSuchAlgorithmException {
boolean releaseMode = false;
if (args != null)
{
for (String arg : args) {
if (arg.equals("release"))
rele... | 7 |
@Override
public boolean execute(MOB mob, List<String> commands, int metaFlags)
throws java.io.IOException
{
String rest="ALL";
if(commands.size()>1)
rest=CMParms.combine(commands,1);
Environmental target=mob.location().fetchFromRoomFavorMOBs(null,rest);
if((target!=null)&&(!target.name().equalsIgnoreCa... | 8 |
private boolean r_verb() {
int among_var;
int v_1;
// (, line 136
// [, line 137
ket = cursor;
// substring, line 137
among_var = find_among_b(a_4, 46);
if (among_var == 0)
... | 8 |
@EventHandler
public void GhastWeakness(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Ghast.Weakness... | 7 |
public LOGLEVEL getLoglevel()
{
if(logLevel == -1)
{
return LOGLEVEL.Nothing;
}
else if(logLevel == 0)
{
return LOGLEVEL.Error;
}
else if(logLevel == 1)
{
return LOGLEVEL.Normal;
}
else if(logLevel == 2)
{
return LOGLEVEL.Debug;
}
else
{
return LOGLEVEL.Normal;
... | 4 |
public static void downloadFile(String fileURL, String saveDir)
throws IOException {
URL url = new URL(fileURL);
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
int responseCode = httpConn.getResponseCode();
// always check HTTP response code first
... | 4 |
public Point getAutoPoint(){
return myAutoPoint;
} | 0 |
public void readInput(Data data) throws NumberFormatException, IllegalChoicesException {
data.resetChoices();
for (int i = 0; i < 4; i++) {
JComboBox<Subject> thisBox = examComboBoxes.get(i);
Subject selectedSubject = (Subject) thisBox.getSelectedItem();
resetBackgro... | 4 |
public final MiniParser.decl_return decl() throws RecognitionException {
MiniParser.decl_return retval = new MiniParser.decl_return();
retval.start = input.LT(1);
Object root_0 = null;
Token i=null;
ParserRuleReturnScope t =null;
Object i_tree=null;
RewriteRuleTokenStream stream_ID=new RewriteRuleToken... | 9 |
public void doOperation() throws ArithmeticException{
if(testOperation()){
BigDecimal result;
switch (operation){
case "X":
total = last.multiply(total).setScale(2, RoundingMode.HALF_UP);
last = null;
operation =... | 5 |
private boolean internalRemove(Investment investment) {
PortfolioIterator iterator = new PortfolioIterator();
Investment i;
boolean removed = false;
while (iterator.hasNext()) {
i = iterator.next();
// case where Investment to remove is a top-level investment
if (i.getUniqueId() == investment.ge... | 4 |
public void readHex() {
if (pos < s.length() &&
((s.charAt(pos) >= '0' && s.charAt(pos) <= '9') ||
(s.charAt(pos) >= 'A' && s.charAt(pos) <= 'F') ||
(s.charAt(pos) >= 'a' && s.charAt(pos) <= 'f'))) {
pos++;
}
else {
throw new JSONPar... | 7 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(((msg.targetMajor()&CMMsg.MASK_MALICIOUS)>0)
&&(!CMath.bset(msg.sourceMajor(),CMMsg.MASK_ALWAYS))
&&((msg.amITarget(affected))))
{
final MOB target=(MOB)msg.target();
if((!target.isInCombat())
&&(msg.source().getVict... | 8 |
public void bubbleSort(boolean printpasses) {
for (int pass = 1; pass < elements.length - 1; pass++) {
int swapcount = 0;
for (int i = 0; i < elements.length - pass; i++) {
T current = elements[i];
T other = elements[i + 1];
int compResult ... | 6 |
void UploadFile( HttpServletRequest request, HttpServletResponse response, String login )
{
json = new JSONObject();
// Создаем фабрику для файлов хранимых на диске
DiskFileItemFactory factory = new DiskFileItemFactory();
// Настраиваем контейнер для хранения файлов
File repository = new File(uploadPat... | 6 |
public Chara talkWith() {
int nextX = 0;
int nextY = 0;
// キャラクターの向いている方向の1歩となりの座標
switch (direction) {
case LEFT:
nextX = x - 1;
nextY = y;
break;
case RIGHT:
nextX = x + 1;
nextY = y... | 9 |
void dorestore ()
{
if (PGF != null) return;
FileDialog fd = new FileDialog(this,
Global.resourceString("Load_Game"), FileDialog.LOAD);
if ( !Dir.equals("")) fd.setDirectory(Dir);
fd.setFile("*.sto");
fd.show();
String fn = fd.getFile();
if (fn == null) return;
Dir = fd.getDirectory();
if (fn.ends... | 8 |
private void updateResults() {
if (UpDown.getNumPlayers()==5 && table.getRowCount()==6) {
( (MyTableModel) table.getModel() ).removeRow();
( (MyTableModel) table.getModel() ).removeColumn();
setTableFormat(5);
}
else if (UpDown.getNumPlayers()==6 && table.getRowCount()==5) {
( (MyTableModel) table.get... | 9 |
@Override
public void rotateClockwise(Board board) {
int rot = (getRotation()+1) % 4;
if (rotateAlgorithm(board, Point.translate(getBase(), BASES[rot]), RELS[rot], getKicks()[getRotation()])) {
addRotation(1);
}
System.out.print("Rotate " + this.toString() + "\n");
} | 1 |
@Override
public Object exec(@SuppressWarnings("rawtypes") List arguments) throws TemplateModelException {
if (arguments.size() != 1) {
throw new TemplateModelException("This function expects 1 parameter");
}
Object type = arguments.get(0);
String ret = "";
if (type instanceof StringModel)... | 7 |
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.