text stringlengths 14 410k | label int32 0 9 |
|---|---|
public int getPageNumber(Reference r) {
Page pg = (Page) library.getObject(r);
if (pg == null)
return -1;
// pg.init();
int globalIndex = 0;
Reference currChildRef = r;
Reference currParentRef = pg.getParentReference();
PageTree currParent = pg.getParen... | 7 |
public boolean setInputFormat(Instances instanceInfo) throws Exception {
super.setInputFormat(instanceInfo);
m_DeltaCols.setUpper(getInputFormat().numAttributes() - 1);
int selectedCount = 0;
for (int i = getInputFormat().numAttributes() - 1; i >= 0; i--) {
if (m_DeltaCols.isInRange(i)) {
... | 9 |
private MoveType getTradeMoveType(Settlement settlement) {
if (settlement instanceof Colony) {
return (getOwner().atWarWith(settlement.getOwner()))
? MoveType.MOVE_NO_ACCESS_WAR
: (!hasAbility("model.ability.tradeWithForeignColonies"))
? MoveType.MOVE_... | 6 |
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof HighLowRenderer)) {
return false;
}
HighLowRenderer that = (HighLowRenderer) obj;
if (this.drawOpenTicks != that.drawOpenTicks) {
return false;
... | 7 |
public MyCustomEventPublisher(MyCustomEventListener listener) {
this.listener = listener;
} | 0 |
@Override
public void executar() throws Exception
{
boolean goBack = false;
while ( !goBack )
{
mostrarOpcions();
int choice = readint("\nOPCIO: ");
switch (choice)
{
case 1:
... | 6 |
public void mutePlayer(Client c, String name) {
if (!isOwner(c)) {
c.sendMessage("You do not have the power to do that!");
return;
}
if (clans[c.clanId] != null) {
for (int j = 0; j < clans[c.clanId].mutedMembers.length; j++) {
for(int i = 0; j < Config.MAX_PLAYERS; i++) {
if (Server.playerHandl... | 7 |
protected Neuron(Element neuronE, NeuralLayer layer) {
m_layer = layer;
m_ID = neuronE.getAttribute("id");
String bias = neuronE.getAttribute("bias");
if (bias != null && bias.length() > 0) {
m_bias = Double.parseDouble(bias);
}
String width = neuronE.get... | 8 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Temperature other = (Temperature) obj;
if (this.unit != other.unit) {
return false;
}... | 3 |
public DataModel getDataModel() {
return dataModel;
} | 0 |
public boolean collidesWith(Placeable other)
{
boolean collidesX = (other.x < this.x && other.x + other.width >= this.x) || (other.x > this.x && this.x + this.width >= other.x) || other.x == this.x;
boolean collidesY = (other.y < this.y && other.y + other.width >= this.y) || (other.y > this.y && this.y + this.widt... | 9 |
public void vizExportConceptTree(LogicObject concept, Module module) {
{ VizInfo self = this;
self.nodeColor = "palegreen";
self.vizExportConcept(concept, module);
self.nodeColor = "yellow";
self.vizAllowObject(concept);
{ LogicObject renamed_Super = null;
edu.isi.powerloom.Pl... | 6 |
public SimpleExample() {
setTitle("Simple example");
setSize(300, 200);
setLocationRelativeTo(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);
String s = (String)JOptionPane.showInputDialog(
this,
"Ge mig ett binärt tal, tack! MAX 4 STYCK... | 3 |
public void addTask(){
int counter=taskCounter.get().intValue();
counter++;
taskCounter.set(counter);
} | 0 |
public static void main(String[] args)
{
/* theme
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(UnsupportedLookAndFeelException e)
{
}
catch(ClassNotFoundException e)
{
}
catch(InstantiationException e)
{
}
catch(Illega... | 6 |
public String sample_frequency_string()
{
switch (h_sample_frequency)
{
case THIRTYTWO:
if (h_version == MPEG1)
return "32 kHz";
else if (h_version == MPEG2_LSF)
return "16 kHz";
else // SZD
return "8 kHz";
case FOURTYFOUR_POINT_ONE:
if (h_version == MPEG1)
return "... | 9 |
public static int m_fht(final int n) {
return (int) Math.pow(2,Math.ceil(log(12.8*n,2)));
} | 0 |
double VectorMin(double[] v) {
double sum = 0;
for (int i = 0; i < v.length; i++) {
sum = Math.min(v[i], sum);//*v[i];
}
return sum;//Math.sqrt(sum);
} | 1 |
public static Pair<Boolean, Pair<Integer,Integer>> check(Map<Integer, Pair<Double,String>> first, Map<Integer, Pair<Double,String>> second){
int firstVal = -1;
int secondVal = -1;
int counter = 0;
for(Map.Entry<Integer, Pair<Double,String>> f : first.entrySet()){
if(counter == 0){
firstVal = f.getKey();
... | 6 |
public void run() {
List<SQLStatement> sqlStatementsToLoad = new ArrayList<>();
int numberStatements;
//noinspection InfiniteLoopStatement
while (true) {
if (unloadedSQLStatements.size() > 0) {
sqlStatementsToLoad.clear();
... | 6 |
private void addExtras(JToolBar toolbar) {
toolbar.addSeparator();
toolbar.add(new TooltipAction("Complete",
"This will finish all expansion.") {
public void actionPerformed(ActionEvent e) {
controller.complete();
}
});
toolbar.add(new TooltipAction("Done?", "Are we finished?") {
public void ac... | 0 |
public boolean isSorted()
{
boolean sorted = true;
// TODO: Determine if the array is sorted.
if (list.size() == 0)
{
return sorted;
}
else
{
String previous = list.get(0);
for (String each : list)
{
if (previous.... | 3 |
public void update(long nowTime) {
if (m_inScroll) {
long delta = nowTime - m_startTime;
if (delta < m_maxTime) {
double t = ((double)delta)/m_maxTime;
m_target.x = (int)(m_scrollTo.x * t + m_scrollFrom.x * (1.0 - t));
m_target.y = (int)(m_scrollTo.y * t + m_scrollFrom.y * (1.0 - t));
}
e... | 2 |
public boolean atTerminator() {
if (!hasNext()) {
return true;
}
final char ch = peek();
return isSpace(ch) || isEndOfLine(ch) || ch == '.' || ch == ',' || ch == '|' || ch == ':' || ch == '(' || ch == ')' || rightDelimiter.charAt(0) == ch;
} | 9 |
@Override
public void cleanup()
{
if( ALSource != null )
{
try
{
// Stop playing the source:
AL10.alSourceStop( ALSource );
AL10.alGetError();
}
catch( Exception e )
{}
try
... | 3 |
public static int personneX(int travee,int orientation){
int centreX = centrePositionX(travee) ;
switch(orientation){
case Orientation.NORD :
centreX -= 10 ;
break ;
case Orientation.EST :
centreX -= 25 ;
break ;
case Orientation.SUD :
centreX -= 10 ;
break ;
case Orientation.OUE... | 4 |
@Override
public int joinRoom(String roomName, short roomKind) throws RemoteException {
// TODO Auto-generated method stub
String check="";
int roomID=-1;
int i;
for(i=0;i<rooms.size();i++)
{
check=(String) rooms.get(i).get(0);
if(check.equals(roomName)==true)
{
roomID=i;
i=rooms.size();
... | 9 |
public void drawText(Graphics2D g) {
// We don't want to corrupt the graphics environs with our
// affine transforms!
Graphics2D g2 = (Graphics2D) g.create();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.transform(affineToText);
// What about the text labe... | 2 |
@Override
public void execute(GameActor character, CharacterAction action) {
switch (action) {
case JUMPRIGHT:
if (character.isOnGround()) character.updateVelocity(7, -80);
else character.updateVelocity(7, 0);
character.setOnGround(false);
... | 9 |
private boolean measurementIsValid(Measurement measurement, OpenCellIdCell cell, double r) {
double distanceToCellTower = Geom.sphericalDistance(
cell.getCellTowerCoordinates().getX(),
cell.getCellTowerCoordinates().getY(),
measurement.getCoordinates().getX(),
measurement.getCoordinates().getY()... | 4 |
public Integer getIdHospital() {
return idHospital;
} | 0 |
public void buyed()
{
for (int i=0; i<recruits.length; ++i) {
recruits[i].updateRange();
}
for (int i=0; i<buys.length; ++i) {
buys[i].checkActive();
}
updateResources();
} | 2 |
private void processAfterLogin(int choice){
switch (choice){
case 1: logout();
break;
case 2: bookRepository.showAllBooks();
break;
case 3: movieStore.showAllMovies();
break;
case 4: getLibraryNumber(... | 7 |
void doNewGame() {
if (gameInProgress) {
// If the current game is not over, it is an error to try
// to start a new game.
message = "You still have to finish this game!";
repaint();
return;
}
deck = new Deck(); // Create the deck and hands ... | 3 |
public static <T extends Satellite> Satellite create(int id, Class<T> type, Planet primary) {
PropertyManager pm = new PropertyManager("config.properties");
Random rnd = new Random();
double satelliteMass = pm.getDoubleProperty("min.Satellite.Mass") + (pm.getDoubleProperty("max.Satellite.Mass")... | 2 |
private void dijkstraButtonClick(java.awt.event.ActionEvent evt) {
//GraphPoint[] gps = graph.getSelectedPoints();
// GraphElement[] ges;// = GraphElement[0];
// if (gps.length == 2) {
// ges = graph.getDijkstraPath(gps[0], gps[1]);
// } ... | 3 |
public Long128 add(Long128 number) {
long lowerSum = myLowerDigits + number.myLowerDigits;
boolean carry = false;
// overflow
if ((lowerSum > 0 && myLowerDigits < 0 && number.myLowerDigits < 0) ||
(lowerSum < 0 && myLowerDigits > 0 && number.myLowerDigits > 0)) {
lowerSum = lowerSum & Long.MAX_VALU... | 8 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public boolean isGlobalAdmin()
{
if (isOwner() == true)
return true;
else if (permission.has(player, "FC_Suite.admin"))
return true;
else if (player.isOp() == true)
return true;
return false;
} | 3 |
public String getName(int ID)
{
try {
int employeeID = ID;
if(employeeID > 0) {
if(employeeID < ReadFromFile.getNumberFromFile("employee.txt")) {
Employee [] checkEmployees = ReadFromFile.findAllEmployeeData();
return checkEmployees[employeeID-1].getFirstName() + " " + checkEmployees[employeeID-1... | 3 |
private ArrayList<Long> generateIdsForCondition(String indexName, String value)
{
ArrayList<Long> results = new ArrayList<>();
NodeReference node = DataWorker.GetNodeReference(indexGlobal);
String key = "";
while (true)
{
key = node.nextSubscript(indexName, value, key);
if (key.equals(""))
br... | 4 |
@Override
protected void paintTabBackground( Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected ){
Graphics2D g2D = (Graphics2D)g;
//colores degradados para los tabs
GradientPaint gradientSel = new GradientPaint( 0, 0, new Color(242,249,242), 0, y+h/2, n... | 5 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost, msg))
return false;
if((myHost instanceof MOB)&&(myHost == this.affected)&&(((MOB)myHost).location()!=null))
{
if((msg.sourceMinor()==CMMsg.TYP_SHUTDOWN)
||((msg.sourceMinor()==CMMsg.TYP_QUIT)&... | 7 |
public static void printList(List<?> lst) {
System.out.println("Index\t Value");
for (int i = 0; i < lst.size(); i++) {
System.out.println(i + "\t " + lst.get(i));
}
} | 2 |
public Response handleObject(Request request) {
String interfaceClassName = metadata.getImplClass();
try {
Class<?> interfaceClazz = Class.forName(interfaceClassName);
return new Response(interfaceClazz.newInstance(),interfaceClazz);
} catch (ClassNotFoundException e) {
log.error("class not found o... | 4 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
VarDeclarationNode other = (VarDeclarationNode) obj;
if (identList == null) {
if (other.identList != null)
return false;
} else if (!... | 9 |
public FloorItem FindItemByID(int ID)
{
FloorItem Return = null;
for(FloorItem Item : FloorItems.values())
{
if(Item.ID == ID)
{
Return = Item;
}
}
return Return;
} | 2 |
public void handlePacket(Packet packet) {
if (!handlers.containsKey(packet.getID())) {
throw new IllegalArgumentException("No handler for packet " + packet.getID());
}
if(!listeners.get(packet.getClass()).isEmpty()){
Iterator<PacketListener> it = listeners.get(packet.getC... | 4 |
public int evaluateGameBoard() {
int score = 0;
// scores for the positions
int mt_score = 0;
int ps_score = 0;
int mb_score = 0;
for (int i = 0; i < all_pieces.size(); i++) {
BoardPiece piece = all_pieces.get(i);
mt_score += m_table.get(piece.piece_type);
if (all_pieces.size() + oponents.size() >... | 6 |
public static List<Participant> getParticipants(int gameid) throws SQLException {
String sql = null;
Connection connection = null;
PreparedStatement query = null;
ResultSet results = null;
try {
sql = "SELECT gameid, participant.playerid, playername, points, notes fro... | 6 |
@Override
public Map<String, String> getCompra(Cliente cliente, Funcionario funcionario){
Map<String, String> compra = new HashMap<>();
try{
conn = ConnectionFactory.getConnection();
String sql = "SELECT to_char(datacompra, 'dd/mm/yyyy') as datacompra, secao.nome as nome FRO... | 3 |
public List<LinkedNode<T>> removeSubNode(T key) {
if (key == null)
return null;
List<LinkedNode<T>> searchResult = new ArrayList<LinkedNode<T>>();
List<LinkedNode<T>> removeResult = new ArrayList<LinkedNode<T>>();
for (LinkedNode<T> node : subNodes) {
if (key.equals(node.getValue())) {
searchResult.ad... | 4 |
public String getMimeType(String incUrl) {
if (incUrl.endsWith(".html") || incUrl.endsWith(".htm")) {
return "text/html";
} else if (incUrl.endsWith(".txt") || incUrl.endsWith(".java")) {
return "text/plain";
} else if (incUrl.endsWith(".gif")) {
return "image... | 8 |
public ArrayList<String> getFileLists(String fn) {
if(fn.endsWith("/"))
fn.substring(0, fn.length()-1);
File file = new File(fn);
ArrayList<String> output = new ArrayList<String>();
if(file.exists()) {
if(file.isFile()) {
// Extract the folder part of the name
int dir_index = fn.lastIndexOf('/');... | 7 |
public static String reformat(String input) {
String output = input.replaceAll("@", "_").replaceAll("^", "_")
.replaceAll("\\*", "_");
if (input.contains("</table>"))
output = output.substring(0, output.indexOf("</table>"));
output = output.replaceAll("d><t", "d> <t").replaceAll("h><t", "h> <t")
.repla... | 1 |
public static void collapseToParent(Node currentNode) {
// Shorthand
JoeTree tree = currentNode.getTree();
OutlineLayoutManager layout = tree.getDocument().panel.layout;
Node parent = currentNode.getParent();
if (parent.isRoot()) {
// Collapse
currentNode.CollapseAllSubheads();
// Redraw and S... | 1 |
public FeedForwardNeuron(Layer previousLayer, List<Double> weigths)
throws WeigthNumberNotMatchException {
if (weigths.size() != previousLayer.getNeuronCount())
throw new WeigthNumberNotMatchException();
this.weigths = new Vector<Double>(weigths.size());
this.weigths.addAll(weigths);
previous = previousLa... | 1 |
public synchronized static void sendMsg2One(UserInfo srcUser,MsgHead msg){
//1.Һ
if(msg.getType()==IMsgConstance.command_find){
//ߵĺб
Set<UserInfo> users=stList.keySet();
Iterator<UserInfo> its=users.iterator();
MsgFindResp mfr=new MsgFindResp();
mfr.setType(IMsgConstance.command_find_resp);
mfr.s... | 8 |
void save()
{
try
{
long t1 = System.currentTimeMillis();
if (debug)
{
System.err.println("DEBUG: nntp: newsrc saving " +
file.getPath());
}
int bs = (groups.size() * 20); // guess an average line length
FileO... | 8 |
private void doEscape(String str)
throws IOException, SQLException, SyntaxException {
String rest = null;
if (str.length() > 2) {
rest = str.substring(2);
}
if (str.startsWith("\\d")) { // Display
if (rest == null){
throw new SyntaxException("\\d needs display arg");
}
display(rest);
} el... | 8 |
void register(CommandSender sender, Command cmd, String commandLabel, String[] args){
if(args.length==1){
plugin.error(sender, "/authy register (email) (phone number)");
}else if(args.length == 3){
}
} | 2 |
public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... | 9 |
public static void test_Gleitpunktzahl() {
/**********************************/
/* Test der Klasse Gleitpunktzahl */
/**********************************/
System.out.println("-----------------------------------------");
System.out.println("Test der Klasse Gleitpunktzahl");
/*
* Verglichen werden die Bi... | 9 |
public void setClassName(String className) {
this.className = className;
} | 0 |
public Image getImage(URL paramURL, String paramString)
{
InputStream localInputStream = getClass().getResourceAsStream("/" + paramString);
if (localInputStream == null)
{
return super.getImage(paramURL, paramString);
}
ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutput... | 3 |
public static int insert(Statement stat, String table, HashMap<String, Object> values) throws SQLException {
String db_Name = DataBaseManager.getDb_name();
System.out.println("--------db_name----->>>>"+db_Name);
String fieldSql = "select COLUMN_NAME from information_schema.columns where table_n... | 6 |
*/
public synchronized byte[] Final () {
byte bits[];
int index, padlen;
MD5State fin;
if (finals == null) {
fin = new MD5State(state);
bits = Encode(fin.count, 8);
index = (int) ((fin.count[0] >>> 3) & 0x3f);
padlen = (index < 56) ? (56 - index) : (120 - index);
... | 2 |
public void putAll( Map<? extends Byte, ? extends Character> map ) {
Iterator<? extends Entry<? extends Byte,? extends Character>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Byte,? extends Character> e = it.next();
this.put(... | 8 |
public static void main(String[] args) {
Client client = new Client();
client.test();
} | 0 |
@Test
public void runTestActivityLifecycle1() throws IOException {
InfoflowResults res = analyzeAPKFile("Lifecycle_ActivityLifecycle1.apk");
Assert.assertEquals(1, res.size());
} | 0 |
public static String colorToString (final Color c)
{
try {
final Field[] fields = Color.class.getFields();
for (final Field f : fields) {
if (Modifier.isPublic(f.getModifiers())
&& Modifier.isFinal(f.getModifiers())
&& Modifier.isSt... | 8 |
public double winPossibility(ArrayList<Action> history, int playerHandStrength) {
int numRaises = 0;
for(Action a : history) {
if(a == Action.RAISE) {
numRaises++;
}
}
int[] histogram = historyToHandStrength.get(numRaises);
int aphs = adjustedHandStrength(playerHandStrength);
if(histogram ==... | 5 |
private boolean usesNetwork(Message message, SoftwareSystem system) {
try {
Component sender = (Component) message.getSender();
Component receiver = (Component) message.getReceiver();
HardwareSet senderHS = null, receiverHS = null;
for (DeployedComponent deployedComponent : system.getDeploymentAlternative... | 8 |
private AnswerCombination generateAnswerCombination(int black, int white) {
List<Token<AnswerColors>> tokens = new ArrayList<Token<AnswerColors>>();
for (int i = 0; i < black; i++) {
tokens.add(new Token<AnswerColors>(AnswerColors.BLACK));
}
for (int i = 0; i < white; i++) {
tokens.add(new... | 3 |
public OreVein[] getWorldData(World w){
if(data.containsKey(w))
return data.get(w);
else if ( conf.contains(w.getName()) ){
data.put(w, OreVein.loadConf( conf.getMapList( w.getName() ) ) );
return data.get(w);
}
else if( def!=null )
return ... | 4 |
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(args.length == 1){
if(!(Plugin.getVoteManager().getVoteByPlayer(args[0]) == null)){
if(args[0].equalsIgnoreCase(sender.getName())){
sender.sendMessage("[RP] You can't vote for yo... | 3 |
public void strongConnectedComponent(int adjacency_matrix[][])
{
for (int i = number_of_nodes; i > 0; i--)
{
if (explore[i] == 0)
{
dfs_1(adjacency_matrix, i);
}
}
int rev_matrix[][] = new int[number_of_nodes + 1][number_of_nodes + ... | 8 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public static JSONObject readFile(String path) throws FileNotFoundException {
File f = new File(path);
if (!f.exists())
throw new FileNotFoundException();
try {
String jString = fileToString(path);
JSONObject obj = (JSONObject) JSONValue.parse(jString);
return obj;
} catch (IOException e) {
e.pr... | 2 |
public List<Item> getAllItems(){
try{
org.hibernate.Query query = session.createQuery("from Item");
@SuppressWarnings("unchecked")
ArrayList<Item> items = (ArrayList<Item>) query.list();
return items;
}
catch(HibernateException e){
Main.getFrame().showError("A hozzáadás sikertelen volt: "+e.getMessage(... | 1 |
public SnakeServerMessage snakeServerMessageDecode(String mess)
throws JSONException {
JSONObject obj = new JSONObject(mess);
double[] p;
JSONArray JArr = obj.getJSONArray("PlayerArray");
SnakeServerMessage SSM = new SnakeServerMessage(JArr.length());
for (int i = 0; i < JArr.length(); i++) {
p = new d... | 2 |
public void createPawnLabelsAdd(JPanel Square[][])
{
arraybPawns= new ArrayList<JLabel>();
arraywPawns= new ArrayList<JLabel>();
//I create the labels for every the pawns
for (int i = 0; i < 8; i++)
{
arraybPawns.add(new JLabel( new ImageIcon("pawn.png") ));
}
for (int i = 0; i ... | 4 |
public void originalCentrosLocal(double paramDistancia,double paramRadio)
{
Iterator elemFuente;
Elemento entrada,salida;
Iterator elemDestino = destino.listaElementos();
double sumaDistancias,sumaValores,distancia,ponderacion;
fuente.generaCentros();
... | 3 |
@Override
public void caseAConstantesDeclaracao(AConstantesDeclaracao node)
{
inAConstantesDeclaracao(node);
if(node.getConst() != null)
{
node.getConst().apply(this);
}
if(node.getVar() != null)
{
node.getVar().apply(this);
}
... | 3 |
@Override
public void keyPressed(KeyEvent evt) {
if (evt.getKeyCode() == KeyEvent.VK_SPACE) {
_listener.actionSPACE();
}
if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
_listener.actionENTER();
}
if (evt.getKeyCode() == KeyEvent.VK_ESCAPE){
_listener.actionESC();
}
} | 3 |
@Override
public void playRoadBuildingCard(IPresenter presenter, EdgeLocation spot1,
EdgeLocation spot2) {
MoveResponse response=presenter.getProxy().playRoadBuildingCard(presenter.getPlayerInfo().getIndex(), spot1, spot2, presenter.getCookie());
if(response != null && response.isSuccessful()) {
presenter... | 2 |
private long parseWithMultiplier(String numberStr) {
char c = numberStr.charAt(numberStr.length() - 1);
final long mult;
if (Character.isDigit(c)) {
mult = 1;
} else {
switch (c) {
case 'k':
case 'K':
mult = 1L << 10;
break;
case 'm':
cas... | 9 |
public void newGameRender(GameContainer gamec, Graphics g) {
g.setColor(Color.black);
g.fillRect(0, 0, WIDTH, HEIGHT);
g.setColor(Color.white);
GC.getSisyphus().draw(0, 0, GC.getSisyphus().getWidth() * .6667f,
GC.getSisyphus().getHeight() * 0.5555f);
if (toggleCursor) {
g.drawString(">> " + command... | 6 |
public void build(SegmentTermEnum indexEnum, int indexDivisor, int tiiFileLength) throws IOException {
if (instantOn.load(this,directory,segment)) {
return;
}
int indexSize = 1 + ((int) indexEnum.size - 1) / indexDivisor;
indexToTerms = new int[indexSize];
// this is only an inital size, it will be GCed on... | 6 |
public boolean isFound(T searchData){
ListNode<T> actualNode = head;
while ((actualNode != null) && !searchData.equals(actualNode.getData())) {
actualNode = actualNode.getNext();
}
if (actualNode == null) {
return false;
} else {
return true;
}
} | 3 |
public boolean fromTrade(int itemID, int fromSlot, int amount) {
if (amount > 0 && (itemID + 1) == playerTItems[fromSlot]) {
if (amount > playerTItemsN[fromSlot]) {
amount = playerTItemsN[fromSlot];
}
addItem((playerTItems[fromSlot] - 1), amount);
if (amount == playerTItemsN[fromSlot]) {
playerTIt... | 5 |
public boolean isEvil(){
switch(this){
case LAWFUL_EVIL:
case NEUTRAL_EVIL:
case CHAOTIC_EVIL:
return true;
default:
return false;
}
} | 3 |
protected final Logger getLogger() {
return LoggerFactory.getLogger(this.getClass());
} | 0 |
public void run(double duration) {
double endtime = _currentTime + duration;
while ((!empty()) && (_head.next.waketime <= endtime)) {
// if ((_head.next.waketime - _currentTime) <= 1e-05) {
// super.setChanged();
// super.notifyObservers();
// }
if ((_currentTime - _lastUpdate) > (MP... | 3 |
public void allowSort(boolean allow) {
if (allow != mAllowSort) {
mAllowSort = allow;
if (!mAllowSort) {
mSortSequence = -1;
}
}
} | 2 |
public void save(String site, String login, String mdp) {
dataSaved = false;
identifiant = new Identifiant();
if (site.isEmpty()) {
site = "NA";
}
if (login.isEmpty()) {
login = "NA";
}
if (mdp.isEmpty() || mdp == null) {
mdp = "NA";
}
byte[] loginEncrypted = this.encrypt(login, clef);
... | 6 |
private void refresh(boolean repopulateCombo) {
if (combo == null || combo.isDisposed())
return;
// $TODO GTK workaround
try {
if (zoomManager == null) {
combo.setEnabled(false);
combo.setText(""); //$NON-NLS-1$
} else {
if (repopulateCombo)
combo.setItems(getZoomManager().getZoomLevelsA... | 8 |
SoundEffect(String soundFileName) {
try {
// Use URL (instead of File) to read from disk and JAR.
URL url = this.getClass().getClassLoader().getResource(soundFileName);
// Set up an audio input stream piped from the sound file.
AudioInputStream audioInputStream = AudioSystem.ge... | 3 |
public boolean check(Hand hand) {
List<Card> cards = new ArrayList<Card>(hand.getCards());
Collections.sort(cards);
Map<Suit, Integer> suits = new TreeMap<Suit, Integer>();
Map<Rank, Integer> ranks = new TreeMap<Rank, Integer>();
for (Card c : cards) {
if (!suits.containsKey(c.getSuit()))
suits.put(c.g... | 3 |
private int truncX (int x) {
if (x < 3) {
x = 3;
}
if ((x + slider.getWidth() + 3) > INDICATOR_WIDTH) {
x = INDICATOR_WIDTH - slider.getWidth() - 3;
}
return x;
} | 2 |
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.