text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void merge(MyList<T> a, MyList<T> tmpArray, int leftPos, int rightPos, int rightEnd) {
int leftEnd = rightPos - 1;
int tmpPos = leftPos;
int numElements = rightEnd - leftPos + 1;
// Main loop
while (leftPos <= leftEnd && rightPos <= rightEnd)
if (a.get(leftPos).compareTo(a.get(rightPos)) <= 0)
... | 6 |
public static boolean logicalSubtypeOfLiteralP(Surrogate type) {
{ NamedDescription desc = Logic.surrogateToDescription(type);
NamedDescription literalclass = Logic.surrogateToDescription(Logic.SGT_STELLA_LITERAL);
Cons literalsubs = Stella.NIL;
if (desc == null) {
return (false);
}... | 9 |
public static boolean palindrome(Node head) {
if(head == null)
return false;
Stack<Integer> stack = new Stack<Integer>();
Node slow = head;
Node fast = head;
while(fast != null && fast.next != null) {
stack.push(slow.data);
slow = slow.next;
fast = fast.next.next;
}
if(fast != null)
slow = ... | 6 |
public void valueChanged(ListSelectionEvent e) {
// Si un élément de la liste est sélectionné.
if(!e.getValueIsAdjusting() && teacherList.getSelectedValuesList().size() > 0) {
// On affiche les champs.
//System.out.println("TeacherPanel.valueChanged() : " + e.getSource());
infoPanel.remove(disabledPanel);
... | 2 |
public void calcDimensions() {
float[] vertex;
// reset min/max points
leftpoint = rightpoint = 0;
bottompoint = toppoint = 0;
farpoint = nearpoint = 0;
// loop through all groups
for (int g = 0; g < groups.size(); g++) {
ArrayList faces = ((Group)grou... | 9 |
public int size() {
int s = 0;
for (Resource r : res.keySet())
if (res.get(r) != 0) s++;
return s;
} | 2 |
public float[] fromRGB(float[] rgbvalue) {
float r = rgbvalue[0];
float g = rgbvalue[1];
float b = rgbvalue[2];
float[] mask = new float[1];
if (Math.round(r) > 0 || Math.round(g) > 0 || Math.round(b) > 0) {
mask[0] = 1;
} else {
... | 3 |
public Dimension preferredLayoutSize(Container parent) {
synchronized (parent.getTreeLock()) {
Insets insets = parent.getInsets();
int ncomponents = parent.getComponentCount();
int w = 0;
int h = 0;
for (int i = 0; i < ncomponents; i++) {
Component comp = parent.getComponent(i);
Dimension ... | 2 |
public boolean isUgly(int number){
if(isPrime(number)){
if(number == 2 || number == 3 || number == 5 || number == 1)
return true;
else{
return false;
}
}
boolean flag = false;
for(int i = 2; i < Math.sqrt(number) + 1; i++){
int a = number % i;
if(a == 0){
flag = isUgly(i)&&isUgly(n... | 8 |
private int[] deepCopyArray(int[] a) {
int[] b = new int[ a.length ];
for (int i=0; i<a.length; i++)
b[i] = a[i];
return b;
} | 1 |
public void readLines(){ // reads lines, hands each to processLine
while(scan.hasNext()){
processLine(scan.nextLine());
}
scan.close();
} | 1 |
public static ArrayList<Position> findOpponentPieces(Board b, int opponentColor) {
ArrayList<Position> pieces = new ArrayList<Position>();
for (int rank = 0; rank < b.board.length; rank++) {
for (int file = 0; file < b.board[rank].length; file++) {
if (opponentColor == Board.black) {
if (b.board[rank][... | 5 |
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
currentLevel = 1;
initLevel(currentLevel);
arrows = new Image("res/arrows.png");
space = new Image("res/space.png");
skybg = new Image("res/skybg.png");
Image levelSprite = new Image("res/level.png");
levelText = new Imag... | 1 |
public boolean deleteSession(int accountId) {
if (!plugin.getDbCtrl().isTableActive(Table.SESSION))
return true;
Connection conn = plugin.getDbCtrl().getConnection();
PreparedStatement ps = null;
try {
String sql = String.format("DELETE FROM `%s` WHERE `accountid` = ?",
plugin.getDbCtrl().getTable(... | 2 |
private List<Edge> pathBFS(Node start, Node destination) {
Queue<Node> frontier = new LinkedList<Node>();
frontier.add(start);
Set<Node> visited = new HashSet<Node>();
visited.add(start);
Map<Node, Edge> tracks = new HashMap<Node, Edge>();
tracks.put(start, null);
while(!frontier.isEmpty()) {
Node n... | 5 |
public void move (int moveID, int row, int column) throws GameException {
// для каждой конкретной ситуации следует выбрасывать свое исключениее
if (moveID < 0 ) throw new GameException(1);
if (row > Game.MaxRow || row < 0) throw new GameException(2);
if (column > Game.MaxColumn || colu... | 5 |
public void openFile(String filename) {
try {
File file = new File(filename);
if(!file.exists()) {
throw new SwingObjectRunException(new FileNotFoundException(file.getAbsolutePath()), this.getClass());
}
if(SwingObjUtils.isWindows()) {
if(file.isDirectory()) {
CommandLine cl=CommandLine.pars... | 5 |
public static String readableTimeSpan(int t){
String b = "";
int s = t % 60;
t /= 60;
int m = t % 60;
t /= 60;
int h = t % 24;
t /= 24;
int d = t;
if(d != 0) b += d + "d ";
if(d != 0 || h != 0) b += h + "h ";
if(d != 0 || h != 0 || m != 0) b += m + "m ";
... | 6 |
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
if ("GET".equalsIgnoreCase((httpRequest.getMethod()))) {
CharResponseWrapper charResponse = new CharR... | 4 |
@Override
public int compare(DirectionStayHotel one, DirectionStayHotel two) {
if (one.getHotel().getName() != null && two.getHotel().getName() != null) {
return one.getHotel().getName().compareTo(two.getHotel().getName());
} else {
return 0;
}... | 2 |
public static List<Record> getRecordToRip(int n) throws SQLException
{
String sql = "SELECT recordnumber from records,formats WHERE baseformat = 'CD' AND format = formatnumber AND riploc IS NULL ORDER BY owner";
PreparedStatement ps = Connect.getConnection().getPreparedStatement(sql);
ResultSet rs ... | 6 |
public String getName() {
Tag tag;
Iterator <Tag> camposInfo;
camposInfo=informacion.iterator();
do{
tag=camposInfo.next();
}while(!tag.getKey().equals("name")||!camposInfo.hasNext());
return tag.getValue();
} | 2 |
private static void render(String s)
{
if (s.equals("{"))
{
buf_.append("\n");
indent();
buf_.append(s);
_n_ = _n_ + 2;
buf_.append("\n");
indent();
}
else if (s.equals("(") || s.equals("["))
buf_.append(s);
else if (s.equals(")") || s.equals("]"))
... | 9 |
@Override
public void updateCheckFinished(UpdateResultEvent event) {
updateCheckThread=null;
switch(event.result)
{
case CHECK_FAILED:
System.out.println("Trouble checking for updates."); //$NON-NLS-1$
break;
case NO_UPDATE:
System.out.println("No update avaiable at this time."); //$NON-NLS-1$
br... | 6 |
private void fireReceiveMessagetEvent(ReceiveMessageEvent evt) throws Exception {
try {
if (invokeHandler == null) {
throw new Exception("InvokeHandler not assigned on server side.");
}
final String method = evt.getMethodName();
final Object params = evt.getParams();
try {
... | 3 |
@SuppressWarnings("CallToThreadDumpStack")
public int computeIdealNumColumns(ArrayList arrayNcolum) {
int idealNumColumns = 0;
try {
if (!arrayNcolum.isEmpty()) {
HashMap<Integer, Integer> mapColumnOccurrence = new HashMap<>();
ArrayList<Integer> listNu... | 6 |
@Test
public void SpecialEste() {
assertTrue("Este oli väärän tyyppinen",
t.onkoPisteessaEste(new Piste(450, 450)) == EsteenTyyppi.SPECIAL);
} | 0 |
private BoundType getBoundTypeForTerminalFloatingPointLiteral(Class<?> type, boolean array)
throws SynException
{
if (float.class.equals(type)) {
return FloatBoundType.INSTANCE;
} else if (type.isAssignableFrom(Float.class)) {
return FloatWrapperBoundType.INSTANCE... | 7 |
public void setData(ItemCaract caract, Numeric value) {
if (caract.getNumericType() != value.getNumericType()) {
throw new IllegalArgumentException();
}
if (data.containsKey(caract.getNumericType())) {
throw new IllegalStateException();
}
data.put(caract, value);
boolean change = false;
do {
chan... | 9 |
public void shuffle() {
Card placeholder = new Card();
int j;
Random generator = new Random();
for (int i = deck.size() - 1; i > 0; i--) {
j = generator.nextInt(i + 1);
placeholder = deck.get(j);
deck.set(j, deck.get(i));
deck.set(i, placeholder);
}
} | 1 |
public var_type div(var_type rhs) throws SyntaxError{
var_type v = new var_type();
keyword returnType = getPromotionForBinaryOp(v_type, rhs.v_type);
if(isNumber() && rhs.isNumber()){
if(rhs.value.doubleValue()==0)
run_err("divide by 0");
else if(returnType == keyword.DOUBLE){
v.v_type = keyword.DOUB... | 7 |
public String toString()
{
// if it is a formula calc that is failing
// if (functionName.length() > 4){
if( true )
{ // 20081203 KSC: functionName is offending function
return "Function Not Supported: " + functionName;
}
int fID = 0;
String f = "Unknown Formula";
try
{
fID = Integer.parseInt( f... | 6 |
public String[] getUploadSN(){
String[] result = null;
if(sncalendars!=null && sncalendars.keySet().size()>0){
result = new String[sncalendars.keySet().size()];
}
else return null;
int index=0;
for(String sn: sncalendars.keySet()){
if(sncalendars.get(sn)!=null && sncalendars.get(sn)[0]!=null)
resu... | 6 |
public static void main(String[] args) {
// Constants
System.out.println(dob);
// dob = "01/01/1901";
} | 0 |
public String toString() {
if (fileName != null) {
return fileName;
} else {
return "MMS Parameters";
}
} | 1 |
@Override
protected String compute() {
if (element == null) return null;
switch (element.getType()) {
case OBJECT: return serializeObject();
case ARRAY: return serializeArray();
case STRING: return serializeString((String)element.getData()... | 8 |
public FieldNode field(FieldID id) {
ClassNode c = classes.get(id.owner);
if (c != null) {
for (Object fo : c.fields) {
FieldNode f = (FieldNode) fo;
if (f.name.equals(id.name) && f.desc.equals(id.desc)) {
return f;
}
}
}
return null;
} | 4 |
public void guardarPersonaDOM(String rutaFichero, LinkedHashMap<Integer, Persona> personas) {
rutaFichero = rutaFichero + ".xml";
try {
DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = documentFactory.newDocumentBuil... | 2 |
@Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if(getValueAt(0, column)==null)
return String.class;
returnValue = getValueAt(0, column).getClass();
... | 3 |
@Override
public void onSpawnTick(SinglePlayerGame game) {
Set<Location> entityLocations = game.getEntityLocations(this);
Set<Location> emptyLocations = new HashSet<>();
for (Location entity : entityLocations) {
ItemStack walls = ((Human) game.getEntity(entity.x, entity.y)).getI... | 8 |
@DELETE
@Path("/{id}")
public void deleteLibro(@PathParam("id") int id) {
if (security.isUserInRole("registered")) {
throw new NotAllowedException();
}
Connection conn = null;
Statement stmt = null;
try {
conn = ds.getConnection();
} catch (SQLException e) {
throw new ServiceUnavailableException(... | 4 |
@Override
protected void doAction(int option)
{
switch (option)
{
case 1:
groupRanking();
break;
case 2:
finalRanking();
break;
case EXIT_VALUE:
doActionExit();
}
} | 3 |
private void update() {
if(Keyboard.pressed[KeyEvent.VK_SPACE]){
System.out.println("KeyEvent work properly");
}
board.update();
Keyboard.update();
} | 1 |
public void clearDoneCases()
{
myDoneCases.clear();
for(int i = 0; i < myAllCases.size(); i++)
((Case)myAllCases.get(i)).reset();
} | 1 |
public List<Object[]> breadthFirstList() {
List<Object[]> list = new ArrayList<Object[]>();
Queue<Object[]> queue = new LinkedList<Object[]>();
for (TaxaNode node : this.root.getChildren()) {
queue.offer(new Object[]{"", node});
}
while (!queue.isEmpty()) {
Object[] object = queue.poll... | 5 |
private void addOdigous(){
/*
* vazei tous odigous ths vashs sthn lista
*/
odigoi=con.getOdigous();
odigoiInfo = new HashMap<String, String>();
for(int i=0;i<odigoi.size();i++){
odigoiInfo=odigoi.get(i);
odigoiId.add(odigoiInfo.get("id"));
listModel.addElement(odigoiInfo.get("onoma")+
" "+od... | 1 |
@Test
public void ensureCoreBudgetItemsInBudgetContainsDifferentValueFormObjectTestThree() {
List<CoreBudgetItem> coreBudgetItemList = new ArrayList<CoreBudgetItem>();
coreBudgetItemList.add(new CoreBudgetItem("Test Description", new BigDecimal("100")));
coreBudgetItemList.add(new CoreBudge... | 1 |
private void buttonComputeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonComputeActionPerformed
// TODO add your handling code here:
Double total,a,b,c,d,e,f,g,h;
/*a=Double.parseDouble(jTextField1.getText());
b=Double.parseDouble(jTextField2.getText());
... | 7 |
public float getDistance(long lifeTime) {
// Linear, speed depends on the lifetime of the bullet.
if(pattern[1] == 0) { return offset[1]+(float)((float)(lifeTime)/(float)(life)*500.0); }
else if(pattern[1] == 1) {
float percent = (float)((float)(lifeTime)/(float)(life));
//System.out.print... | 4 |
@Override
protected DiffResult doInBackground() throws Exception {
pm = new ProgressMonitor(mp.getRootPane(), "Working...", null, 0, 100);
DiffResult res = new DiffResult();
if (oldFile != null && newFile != null) {
pm.setMaximum(3);
oldSchema = HecateParser.parse(oldFile.getAbsolutePath());
pm.setProgr... | 8 |
private void acao134() throws SemanticError {
if (!Tipo.isCompativel(tipoLadoEsquerdo, tipoExpressao))
throw new SemanticError("Tipos incompatíveis");
// Gerar Código
} | 1 |
public Object getValueAt(int rowIndex, int columnIndex) {
Group group = groupList.get(rowIndex);
switch (columnIndex) {
case 0:
return group.getName();
case 1:
return group.getLevel().getName();
case 2:
return group.getTeacher();
case 3:
return group.getCapacity();
case 4:
String scheduleTe... | 7 |
public boolean isKeyDown(final int keycode) {
Boolean down = keymap.get(keycode);
if (down == null || down == false)
return false;
else
return true;
} | 2 |
@Override
public void redo() {
// Shorthand
Node youngestNode = ((PrimitiveUndoableMove) primitives.get(0)).getNode();
JoeTree tree = youngestNode.getTree();
if (isUpdatingGui()) {
// Store nodeToDrawFrom if neccessary. Used when the selection is disconnected.
OutlineLayoutManager layout = tree.getDocum... | 7 |
public void stopMoving() {
//TODO: Fixa
if (direction.equals("left")) {
setCurrent(getNormalLeft());
} else if (direction.equals("right")) {
setCurrent(getNormalRight());
} else if (direction.equals("left")) {
setCurrent(getLeftAir());
} else if (direction.equals("left")) {
setCurrent(getRightA... | 4 |
@Override
final public void computeGradient() {
//
final int last = this.frameidx;
//
for (int t = last; t >= 0; t--) {
//
if (t < last) {
this.copyGradOutput(this.frameidx + 1, this.frameidx);
}
//
// from l... | 4 |
public void ejecutar() {
JFrame ventana = new JFrame("Mi Ventana");
ventana.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
ventana.setVisible(true);
panel = new MiPanel();
ventana.getContentPane().add(panel);
ventana.pack();
//ventana.setResizable(false)... | 7 |
public static int getDayFromDate(Date d){
String[][] YEARS = {
{ "00", "06", "17", "23", "28", "34", "45", "51",
"56", "62", "73", "79", "84", "90" },
{ "01", "07", "12", "18", "29", "35", "40", "46",
"57", "63", "68", "74", "85", "91", "96"... | 8 |
public void setSteeringThrusters(boolean port, boolean starboard) {
portThrust.setX(0);
portThrust.setY(0);
starboardThrust.setX(0);
starboardThrust.setY(0);
if (port)
portThrust.setX(-_STEERINGFORCE);
if (starboard)
starboardThrust.setX(_STEERINGFORCE);
} | 2 |
private void blackPawnMove(Point currentPoint, Piece currentPiece) {
addToMovesLocal(currentPoint, currentPiece);
if (((int) currentPoint.getY() == 1 && !currentPiece.getColor())) {
blackPawnMoveFirst(currentPoint, currentPiece);
}
Point targetPoint = pieceMove(currentPoint, 0, 1);
if (isOpen(targetPoint))... | 5 |
public static void kadane() {
long sum = 0;
int startRow = 0;
for (int i = 0; i < rows; i++) {
long cc = comp[i][right] - comp[i][left - 1];
if (sum + cc > k)
while (sum + cc > k && startRow < i) {
sum -= comp[startRow][right] - comp[startRow][left - 1];
startRow++;
}
sum += cc;
if (... | 7 |
public FrameGeneralWindow(String title) {
super(title);
initialize();
} | 0 |
@Override
public void validate(Ingredient category) throws IngredientRepositoryException {
if(getIngredient(category.getIngredientId()) == null){
throw new IngredientRepositoryException("Could not find category with id"+category.getIngredientId());
}
for(int parent : category.getParentIngredients()){
Ingre... | 5 |
protected void verifierHoraires() {
int plageIndex = 0;
for (Chemin chemin : this.tournee.getCheminsResultats()) {
Livraison currentLivraison;
try {
currentLivraison = ((Livraison) zoneGeo.getNoeudById(chemin.getDestination().getIdNoeud()));
}
... | 4 |
private boolean isInside(KDPoint q, double distActual) {
return q.getX()>=xi && q.getX()<=xf && q.getY()>=yi && q.getY()<=yf;
} | 3 |
public void deposit(BigInteger amount) throws IllegalArgumentException {
if ( (amount == null) || (amount.compareTo(BigInteger.ZERO) <= 0) )
throw new IllegalArgumentException();
setBalance(this.getBalance().add(amount));
} | 2 |
public void setDiagnosticoCollection(Collection<Diagnostico> diagnosticoCollection) {
this.diagnosticoCollection = diagnosticoCollection;
} | 0 |
private static void writeNodeAndChildren( BufferedWriter writer,
ENode enode, double cutoff, HashMap<String, NewRDPParserFileLine> rdpMap,
HashMap<String, Double> pValuesSubject) throws Exception
{
NewRDPParserFileLine fileLine = rdpMap.get(enode.getNodeName());
String rdpString = "NotClassified";
... | 7 |
public static double crank(List<Double> w)
{
double s;
int j=1,ji,jt;
double t,rank;
int n=w.size();
s=0.0f;
while (j < n)
{
if ( ! w.get(j).equals(w.get(j-1)))
{
w.set(j-1,j + 0.0);
++j;
}
else
{
for (jt=j+1;jt<=n && w.get(jt-1).equals(w.get(j-1));jt++);
rank=0.5f*(... | 6 |
protected final void onKeyPress(char var1, int var2) {
if(var2 == 1) {
this.minecraft.setCurrentScreen((GuiScreen)null);
} else if(var2 == 28) {
NetworkManager var10000 = this.minecraft.networkManager;
String var4 = this.message.trim();
NetworkManager var3 = var10000;
... | 7 |
void init(int m, int n) {
if (m == 1 && n == 1) {
closed = true;
index[0] = 0;
index[1] = 0;
return;
}
index[0] = 0;
index[1] = 0;
max[0] = m;
max[1] = n;
count = 1;
whichIndex = 1;
step = 1;
... | 3 |
public static void ana(int depth, char [] words, boolean [] cans, char [] orig){
if(depth == words.length){
for(int x = 0; x < words.length; x++){
System.out.print(words[x]);
}
System.out.println();
}else {
int idx []= new int [orig... | 5 |
public String getDefaultEncoding() {
return defaultEnc;
} | 0 |
@Override
public void conexion(Enum.Connection tipo) throws Exception {
try {
GenericConnection oConexion;
if (tipo == Enum.Connection.DataSource) {
oConexion = new DataSourceConnection();
} else {
oConexion = new DriverManagerConnection()... | 2 |
private void sendMTFValues6(final int nGroups, final int alphaSize)
throws IOException {
final byte[][] len = this.data.sendMTFValues_len;
final OutputStream outShadow = this.out;
int bsLiveShadow = this.bsLive;
int bsBuffShadow = this.bsBuff;
for (int t = 0; t < nGroup... | 8 |
public String toString() {
return "#" + getName() + "(" + countDown + "), ";
} | 0 |
public LLParseTableAction(GrammarEnvironment environment) {
super("Build LL(1) Parse Table", null);
this.environment = environment;
this.frame = Universe.frameForEnvironment(environment);
} | 0 |
public static boolean shutDown(String username, String pass){
String position = checkPosition(username, pass);
if(position.equals("manager")){
DatabaseProcess.closeConnection();
System.exit(0);
return true;
}
return false;
} | 1 |
public int getequal(String id) throws Exception{
try{
@SuppressWarnings("resource")
ObjectInputStream osi = new ObjectInputStream(new FileInputStream("membercollection.txt"));///óϾ , Ͼ׳ϴ° ҽ߰
this.setMemberCount(osi.readInt());
collectionm.clear();
for( int i= 0; i< this.getMemberCount();i++){
Memb... | 4 |
protected int getErrorCode(Throwable e) {
if (e instanceof RemoteAccessException) {
e = e.getCause();
}
if (e != null && e.getCause() != null) {
Class<?> cls = e.getCause().getClass();
// 是根据测试Case发现的问题,对RpcException.setCode进行设置
if (SocketTimeoutException.class.equals(cls)) {
return RpcException.T... | 7 |
public double pow2(double x, int n){
double temp ;
if(n == 0)
return 1;
if(n % 2 ==1){
temp = pow2(x,n/2);
return temp*temp*x;
}
else{
temp = pow2(x,n/2);
return temp*temp;
}
} | 2 |
@Override
public void actionSPACE() {
if (Fenetre._state == StateFen.Level){
if (Fenetre._list_birds.size() != 0) { // Test s'il existe un oiseau
if(_currentBird.getStationnaire()|| _currentBird.getTakeOff()== 0){
if (_currentBird.getMoving()) {
if (_DEBUG) System.out.println("Vol Stationnaire.")... | 9 |
public void setCarNumber(int value) {
this._carNumber = value;
} | 0 |
public Integer getQuantity() {
return quantity;
} | 0 |
@Override
public List<StrasseDTO> findStreetsByStartPoint(Long startPunktId, boolean b) {
List<StrasseDTO> ret = new ArrayList<StrasseDTO>();
if(startPunktId ==1){
StrasseDTO s= new StrasseDTO();
s.setStartPunktId(Long.valueOf(1));
s.setEndPunktId(Long.valueOf(2));
s.setDistanz(Long.valueOf... | 7 |
@Override
public void runOnce() throws InterruptedException {
Collections.shuffle(agents);
vue.grille();
for (AgentAbs agent : agents) {
agent.run(environment);
if (agent.name.equals("PacMan")){
pacMan = new Point(agent.pos_x, agent.pos_y);
((EnvironnementPacMan) environment).goDijkstra(pacMan.x, pa... | 2 |
@SuppressWarnings("unchecked")
public static <T extends Number> T getNeutralSumElem(Class<T> type) {
switch (type.getSimpleName()) {
case "Double":
return (T) (new Double(0.0));
case "Float":
return (T) (new Float(0.0));
case "Byte":
return (T) (new Byte((byte) 0));
case "Short":
return... | 6 |
public void payPlayer(ASPlayer player) {
double amount;
double percent = getActivityPercent(player);
if (config.ecoModePercent()) {
amount = getPercentPayment(player);
} else if (config.ecoModeBoolean()) {
amount = getBooleanPayment(player);
} else {
return;
}
Player target = getServer().getPlay... | 3 |
public Location randomAdjacentLocation(Location location)
{
int row = location.getRow();
int col = location.getCol();
// Generate an offset of -1, 0, or +1 for both the current row and col.
int nextRow = row + rand.nextInt(3) - 1;
int nextCol = col + rand.nextInt(3) - 1;
... | 6 |
@Test
public void testReadField_private()
{
Assert.assertEquals(
"private",
ReflectUtils.readField(new Bean(), "_field1")
);
} | 0 |
private static void printOptions() {
StringBuilder b = new StringBuilder();
for (Option o : Option.CODES) {
if (b.length() > 0) b.append(", "); //$NON-NLS-1$
b.append(o.code());
}
b.insert(0, Messages.getString("Help.list_options")); //$NON-NLS-1$
System.out.println(headerSection(b));
... | 8 |
List<Score> matchCoupleRound(Map<Person, List<Score>> table){
int size = 0;
int preSize;
List<Score> ret = new ArrayList<>();
do{
printTable(table);
preSize = size;
ret.addAll(matchCoupleFirst(table));
ret.addAll(matchCoupleChain(table));
... | 1 |
private void onOpenClicked() {
if (!currentProgram.equals(getProgramCode())) {
int returnValue = JOptionPane.showConfirmDialog(this, "You have not saved your program! Do you want to continue anyway?", "Warning", JOptionPane.YES_NO_OPTION);
if (returnValue == JOptionPane.OK_OPTION) {
JFileChooser fileChooser... | 4 |
public String getTilebmpFile() {
if (tilebmpFile != null) {
try {
return tilebmpFile.getCanonicalPath();
} catch (IOException e) {
}
}
return null;
} | 2 |
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... | 8 |
@Override
public void paint(Graphics g) {
super.paint(g);
g.setColor(BG_COLOR);
g.setFont(STR_FONT);
g.fillRect(0, 0, this.getSize().width, this.getSize().height);
for (int y : _0123) {
for (int x : _0123) {
drawTile(g, tiles[x + y * ROW], x, y);
... | 2 |
public void moveToCenter() {
Point boxMin = new Point ();
Point boxMax = new Point ();
for (Point p : listOfPoints) {
if (p.getX() < boxMin.getX()) {
boxMin.setX(p.getX());
}
if (p.getY() < boxMin.getY()) {
boxMin.setY(p.getY());
}
if (p.getZ() < boxMin.getZ()) {
boxMin.setZ(p.getZ()... | 8 |
protected int getBreedingAge()
{
return BREEDING_AGE;
} | 0 |
public void useSkill(Skill skill, Character character) {
if(mp >= skill.getMpCost() && isWithinSkillRange(skill, character)) {
setMp(mp - skill.getMpCost());
float damage = skill.getDamage();
if(skill.isOffensive() && isEnemyCharacter(character.getOwner())) {
if(character.isOnDefend() && skill.is... | 9 |
@Override
public void setToRandomValue(final RandomGenerator a_numberGenerator) {
final IntList sortedSubSet = new IntArrayList();
final Gene[] m_genes = getGenes();
for (int i = 0; i < m_genes.length; i++) {
int value = -1;
do {
m_genes[i].setToRando... | 4 |
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.