text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public void run(int interfaceId, int componentId) {
if (stage == -1) {
sendEntityDialogue(SEND_1_TEXT_CHAT,
new String[] {
NPCDefinitions.getNPCDefinitions(npcId).name,
"The trip will cost you 30 coins." }, IS_NPC,
npcId, 9827);
stage = 0;
} else if (stage == 0) {
sendDia... | 7 |
private int phraseFreq() throws IOException {
// reset state
final PostingsAndPosition[] postings = this.postings;
for (PostingsAndPosition posting : postings) {
posting.freq = posting.postings.freq();
posting.pos = posting.postings.nextPosition();
posting.upTo = 1;
}
int freq = 0... | 8 |
@Override
public void init(){
// Build a polygon list
double [][]distDataProp = new double[][] {{.25,.45, .20},{.56, .89, .45}, {.6, .3,.7}};
List<Polygon> polygons = new ArrayList<Polygon>();
for(int i = 0; i < distDataProp.length -1; i++){
for(int j = 0; j < distDataProp[i... | 2 |
static Boolean othersHasBeenTo(HashSet<String> cluster, String bid, String uid) {
for (String user: cluster) {
if (!user.equals(uid)) {
if (ubScore.getCount(user, bid) != 0) {
return true;
}
}
}
return false;
} | 3 |
@Override
public boolean equals(Object athat) {
if (this == athat) return true;
if (!(athat instanceof News)) return false;
News that = (News)athat;
return
( this.title.equals(that.title) ) &&
( this.content.equals(that.content) ) &&
( this.publisher.equals(that.publis... | 8 |
@SuppressWarnings("unchecked")
BitSet lookupValue(String variable, boolean plurals) throws ScriptException {
if (logMessages)
viewer.scriptStatus("lookupValue(" + variable + ")");
Object value = variables.get(variable);
if (value != null) {
if (value instanceof Token[]) {
value = expression((Token[]) v... | 7 |
protected void fall() {
if (normalPhysics && falling) {
if (velY > maxVelY) velY = maxVelY;
velY += world.getGravity();
}
} | 3 |
private static void changeCol(int аrray[][], int col1, int col2) {
int help;
for (int i = 0; i < аrray.length; i++) {
help = аrray[i][col1];
аrray[i][col1] = аrray[i][col2];
аrray[i][col2] = help;
}
} | 1 |
public JavaClient() {
// XXX Later for chess
//ResModel.init(this.getClass());
this.view = new ClientViewPanel();
// Add listeners
view.getFrame().addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent winEvt) {
if(thread !... | 6 |
public void keepItem2() {
for(int i = 0; i < playerItems.length; i++) {
int highest = 0;
int value = (int)Math.floor(GetItemShopValue(playerItems[i]-1, 0, i));
if(value > highest && playerItems[i]-1 != keepItem && playerItems[i]-1 != -1) {
highest = value;
keepItem2 = playerItems[i]-1;
keepItemAm... | 4 |
public void ExpandLevel(int xExpand, int yExpand) {
render = false;
HashMap<Integer,HashMap<Vector2i,Tile>> LayerMap = new HashMap<Integer,HashMap<Vector2i,Tile>>();
HashMap<Vector2i,Tile> TileMap = new HashMap<Vector2i,Tile>();
Vector2i Tc;
for(int layer = 1; layer <= Layers; layer++) {
for(int yt = 0;... | 5 |
@Override
public void setBoolean(long i, boolean value)
{
if (ptr != 0) {
Utilities.UNSAFE.putInt(ptr + sizeof * i, value == true ? 1 : 0);
} else {
if (isConstant()) {
throw new IllegalAccessError("Constant arrays cannot be modified.");
}
... | 4 |
private void dhcpDiscover(){
int discoverTime = -1;
// create discover packet
LOG.info("create discover packet");
byte[] discoverMessage = createDiscoverMessage();
DatagramPacket discoverPacket = null;
try {
discoverPacket = new DatagramPacket(discoverMessage... | 7 |
public void doAutoAction(){
isChevron = false;
isExxon = false;
isShell = false;
isTexaco = false;
DPHreader dphReader = DPHreader.getInstance();
ArrayList<String> userChoices = dphReader.readAnswers(GasDecisionProcess.getUserDPH(), ID);
isUserResponded = true;
int answe... | 9 |
@Override
public void addNodeToOutline (NodeImpl node, int level) {
// for appendage, we need to consider the current node's level
// and the node-to-be-added's level
int levelDelta = level - currentLevel ;
// in case we need to go back up the outline
int climbCounter = 0 ;
Node tempNode = null ;
... | 4 |
protected static boolean triangleEdgeTest( float[] v0, float[] v1, float[] u0, float[] u1, float[] u2, int i0,
int i1 )
{
float ax = v1[i0] - v0[i0];
float ay = v1[i1] - v0[i1];
// Test edge u0:u1 against v0:v1
boolean tf = edgeEdgeTest( v0, u0, u1, i0, i1, ax, ay );
if ( tf )
return true;
... | 2 |
@Test
public void testStartingPositionsEqualToNumberOfPlayers() {
int count = 0;
for (Element e : grid.getElementsOnGrid())
if (e instanceof PlayerStartPosition)
count++;
assertEquals(count, game.getPlayers().size());
} | 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 ... | 7 |
public Collection read (Kryo kryo, Input input, Class<Collection> type) {
Collection collection = create(kryo, input, type);
kryo.reference(collection);
int length = input.readInt(true);
if (collection instanceof ArrayList) ((ArrayList)collection).ensureCapacity(length);
Class elementClass = this.elementClass... | 8 |
public void read() {
// do not read if protocol has terminated. only write of pending data is
// allowed
if (_protocol.shouldClose()) {
return;
}
SocketAddress address = _sChannel.socket().getRemoteSocketAddress();
logger.info("Reading from " + address);
ByteBuffer buf = ByteBuffer.allocate(BUFFER_SI... | 3 |
private boolean complExpAritmetica() {
boolean erro = false;
if (!opSecundario()) {
erro = true;
} else {
if (!acabouListaTokens()) {
nextToken();
if (!termoAritmetico()) {
erro = true;
} else {
... | 5 |
private String justifyLine(ArrayList<String> line, int indent) {
if (line.size() == 1) {
return line.get(0);
}
String result = "";
int l = charsIn(line);
if (line.size() - 1 + l == _textWidth || !_justify) {
return lineToString(line);
}
dou... | 7 |
@EventHandler
public void onSignClick(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if(!player.hasPermission("woolrush.sign"))
return;
Block block = event.getClickedBlock();
if(block==null)
return;
if((block.getType().equals(Material.WALL_SIGN)) || (block.getType().equals(Material.SI... | 7 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof OAuth)) return false;
OAuth oAuth = (OAuth) o;
if (consumerKey != null ? !consumerKey.equals(oAuth.consumerKey) : oAuth.consumerKey != null)
return false;
if (consumerSecr... | 6 |
public static String escape(String string) {
StringBuffer sb = new StringBuffer();
for (int i = 0, length = string.length(); i < length; i++) {
char c = string.charAt(i);
switch (c) {
case '&':
sb.append("&");
break;
cas... | 6 |
private boolean verifyChapPassword(String plaintext)
throws RadiusException {
if (plaintext == null || plaintext.length() == 0)
throw new IllegalArgumentException("plaintext must not be empty");
if (chapChallenge == null || chapChallenge.length != 16)
throw new RadiusException("CHAP challenge must be 16 byt... | 8 |
public ArrayList<Report> getReports(int cabin_id) {
ArrayList<Report> rp = new ArrayList<Report>();
ResultSet rs = null;
try{
statement = connection.createStatement();
String sql = "select * from reports where cabin_id = " + cabin_id + " order by report_date desc";
rs = statement.executeQuery(sql);
w... | 6 |
public static void renameFile(String srcPath, String aimPath) throws UtilException {
File srcFile = new File(srcPath);
if (!(srcFile.exists()))
throw new UtilException("原始文件不存在:" + srcPath);
File aimFile = new File(aimPath);
if (aimFile.exists())
throw new UtilException("目标文件已存在:" + aimPath);
srcFile.... | 2 |
public void removeSprite(Sprite sprite) {
sprites.remove(sprite);
} | 0 |
@SuppressWarnings("unchecked")
public static <T extends Number> SparseMatrix mulSparseMatrixWithSparseMatrix(SparseMatrix a, SparseMatrix b, Class<T> type) {
SparseMatrix result = null;
try {
if (a == null || b == null) {
throw new NullPointerException();
}
int size = a.getSize();
... | 8 |
private java.util.logging.Level mapJULLevel(int level) {
java.util.logging.Level julLevel = null;
switch (level) {
case SEVERE:
julLevel = java.util.logging.Level.SEVERE;
break;
case WARNING:
julLevel = java.util.logging.Level.WARNING;
break;
case INFO:
julLevel = java.util.logging.Lev... | 7 |
public static String encodeBytes(byte[] source)
{
int off = 0;
int len = source.length;
int len43 = len * 4 / 3;
byte[] outBuff = new byte[(len43) // Main 4:3
+ ((len % 3) > 0 ? 4 : 0)]; // Account for padding
int d = 0;
int e = 0;
int len2 = len - 2;
for (; d < len2; d += 3, e += 4)
encode3to4... | 4 |
@Override
public void propertyChange(PropertyChangeEvent evt) {
if(evt.getSource() == initalGold)
{
if((int)initalGold.getValue() < 0)
{
initalGold.setValue(new Integer(0));
}
}
else if(evt.getSource() == initalCardDraw)
{
if((int)initalCardDraw.getValue() < 0)
{
initalCardDraw.setValu... | 8 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target==null)
return false;
if(target.fetchEffect(ID())!=null)
{
mob.tell(targ... | 9 |
final private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
}
} else {
jj_scanpos... | 9 |
public Object nth(int position) {
SListNode currentNode;
if ((position < 1) || (head == null)) {
return null;
} else {
currentNode = head;
while (position > 1) {
currentNode = currentNode.next;
if (currentNode == null) {
return null;
}
... | 4 |
public boolean sendQMessages() throws PostServiceNotSetException{
if (this.postservice == null){
throw new PostServiceNotSetException();
}
boolean atLeastOneUpdated = false;
switch (Athena.shuffleMessage){
case 1:
Object[] arrayx = this.getVari... | 9 |
@Override
public void loadCustom()
{
usedGroups.clear();
unusedGroups.setAll(CraftingGroups.values());
JsonValue jGroups = asset.getObject().get("groups");
if(jGroups != null && jGroups.isArray())
{
for(JsonValue v: (JsonArray) jGroups)
{
if(v.isString())
{
try
{
CraftingGroups... | 5 |
private void browseHistory(KeyEvent e) {
int c = e.getKeyCode();
String command = "";
if (c == KeyEvent.VK_UP)
command = CommandHistory.getPrevious();
else if (c == KeyEvent.VK_DOWN)
command = CommandHistory.getNext();
if ( command.length() == 0)
... | 3 |
@Override
protected void checkBeforeParse(Method method) throws DaoGenerateException {
super.checkBeforeParse(method);
MapperBy mapperBy = method.getAnnotation(MapperBy.class);
if (mapperBy == null
&& (ClassHelper.isTypeList(method.getReturnType()) && ClassHelper.getReturnGenericType(method) == null)) {
... | 3 |
public void read(final ProtocolDecoder decoder) throws Exception
{
// Read until protocol has enough data to decode
buffer.clear();
do
{
channel.read(buffer).get(timeout_ms, MILLISECONDS);
}
while (buffer.position() < decoder.getResponseSize(buffer));
// Prepare to decode
buffer.flip();
if ... | 4 |
protected String protectedMethod()
{
return "protected";
} | 0 |
private boolean reachedMaxRaises() {
int historySize = actionHistory.size();
if(historySize < maxNumberOfRaises)
return false;
for(int i = maxNumberOfRaises; i >= 1; i--) {
if(actionHistory.get(historySize - i) != Action.RAISE)
return false;
}
return true;
} | 3 |
public static int testPrivate(int testNum)
{
String inputFilename = String.format("tests/testP%02d.crx", testNum);
String outputFilename = String.format("tests/testP%02d.rea", testNum);
String expectedFilename = String.format("tests/testP%02d.out", testNum);
Scanner s = null;
try
{
s = new Scanner(new ... | 9 |
public AsyncImportResult(Document asyncImportResultXml)
{
Element elem = ((Element)(asyncImportResultXml
.getElementsByTagName("status")).item(0));
String statusText = XmlUtils.getElemText(elem);
if (statusText.equals("created")){
... | 7 |
public String convertHTMLCode2Unicode(String text) {
StringBuffer newString = new StringBuffer();
int textLen = text.length();
for (int i = 0; i < textLen; i++) {
char charAtI = text.charAt(i);
if (i + 2 < textLen && charAtI == '&' && text.charAt(i + 1) == '#' && text.charAt(i + 2) == '7') {
int indexO... | 7 |
@Override
public void caseAParaPassoComando(AParaPassoComando node)
{
inAParaPassoComando(node);
{
List<PComando> copy = new ArrayList<PComando>(node.getComando());
Collections.reverse(copy);
for(PComando e : copy)
{
e.apply(this);
... | 5 |
@Override
public void setXML(String str)
{
final XMLLibrary xmlLib = CMLib.xml();
final List<XMLLibrary.XMLTag> xml = xmlLib.parseAllXML(str);
final String[] codes=getStatCodes();
for (final String code : codes)
{
String val=xmlLib.getValFromPieces(xml,code.toUpperCase());
if(val==null)
val="";
... | 9 |
private void setupUI() {
setBackground(Color.WHITE);
updateScale();
updateNameTableTiles(true);
setMinimumSize(new Dimension(currentPixelArrayWidth * MIN_SCALE, currentPixelArrayHeight * MIN_SCALE));
// setPreferredSize(new Dimension(currentWidth, currentHeight));
... | 9 |
protected Node<T> getGreatest(Node<T> startingNode) {
if (startingNode == null)
return null;
Node<T> greater = startingNode.greater;
while (greater != null && greater.id != null) {
Node<T> node = greater.greater;
if (node != null && node.id != null)
... | 5 |
private static int factorial(int number) {
if (number == 1) {
return 1;
} else {
return number * factorial(number - 1);
}
} | 1 |
@EventHandler
public void WitherPoison(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("Wither.Poison.D... | 7 |
public void writeUntil(final int end, final CodedOutputStream output)
throws IOException {
while (next != null && next.getKey().getNumber() < end) {
ExtensionDescriptor extension = next.getKey();
if (messageSetWireFormat && extension.getLiteJavaType() ==
... | 6 |
private String getComerMover(int fila, int columna, int turno){
if((this.fila+2==fila||this.fila-2==fila)&&(this.columna-1==columna||this.columna+1==columna)){
return getCaballo(turno);
}else if((this.fila+1==fila||this.fila-1==fila)&&(this.columna-2==columna||this.columna+2==columna)){
... | 8 |
public void update() {
steps--;
float newX, newY;
float percentage = ((float) steps / (float) maxSteps);
width = width * percentage;
height = height * percentage;
newX = startX - ((int) width / 2);
newY = startY + (endY - startY) - ((endY - startY) * percentage)... | 2 |
protected LoginResult charcrRaceStart(final LoginSessionImpl loginObj, final Session session)
{
MOB mob=loginObj.mob;
session.setMob(loginObj.mob);
if(CMSecurity.isDisabled(CMSecurity.DisFlag.RACES))
{
Race newRace=CMClass.getRace("PlayerRace");
if(newRace==null)
newRace=CMClass.getRace("StdRace");
... | 8 |
public void handleCreateFile(FolderWatcherQueue s) {
Connection con = DBManager.establishConnection();
DBManager db = new DBManager();
db.serverInsert(con, FileFunctions.getRelativePath(s.getFullPath()),
db.getTimeStamp(s.getDate()));
if (FileFunctions.isDirectory(s.getFullPath())) {
File[] files = new F... | 3 |
private void removeDuplicateRoutePaths() {
// get rid of any duplicate routes, because it seems to happen?
ListIterator li;
if (_paths != null) {
li = _paths.listIterator();
if (li.hasNext()) {
RoutePath keep = (RoutePath) li.next();
while (li.hasNext()) {
RoutePath check = (RoutePath) li.next(... | 8 |
public void testPropertySetDayOfMonth() {
MonthDay test = new MonthDay(4, 6);
MonthDay copy = test.dayOfMonth().setCopy(12);
check(test, 4, 6);
check(copy, 4, 12);
try {
test.dayOfMonth().setCopy(33);
fail();
} catch (IllegalArgumentExcept... | 2 |
public static X509Info x509FromKeyStore(KeyStore keyStore, String password) {
try {
char[] pwchars = password.toCharArray();
X509Certificate cert = null;
Key key = null;
Enumeration<String> aliases;
aliases = keyStore.aliases();
while (... | 5 |
private void dataToAlbum(String key, String value) {
if (key.toString().equals("name"))
album.setName(value);
if (key.toString().equals("genre"))
album.setGenre(value);
if (key.toString().equals("year"))
album.setYear(value);
if (key.toString().equals("artist")) {
String[] artists = value.split(", "... | 5 |
public boolean killHuman(Human human) {
if (null == human) {
return false;
}
Iterator<Integer> iter = this.playground.keySet().iterator();
while (iter.hasNext()) {
Integer potentialVictimKey = iter.next();
Human potentialVictim = this.playground.get(potentialVictimKey);
if (potentialVictim == ... | 3 |
private int getMaxInd(int pos1, int pos2) {
if (Math.min(pos1, pos2) >= size)
throw new ArrayIndexOutOfBoundsException(String.format(
"Invalid data: %d, %d", pos1, pos2));
if (Math.max(pos1, pos2) >= size) return Math.min(pos1, pos2);
return he... | 3 |
public void SetOver(boolean isOver) {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: SetOver() BEGIN");
}
m_isOver = isOver;
if (test || m_test) {
System.out.println("GameBoardGraphics :: SetOver() END");
}
} | 4 |
public boolean withinRange(RangeType rangeType, int value) {
switch (rangeType) {
case HUMIDITY:
return (humidity[0] <= value && value <= humidity[1]);
case TEMPERATURE:
return (temperature[0] <= value && value <= temperature[1]);
case ALTITUDE:
return... | 6 |
public void setMsgType(int msgType) {
MsgType = msgType;
} | 0 |
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 void bossDeath() {
bossliving = false;
endGame(EndReason.END_REASON_SUCCESS);
} | 0 |
public void visit_fstore(final Instruction inst) {
stackHeight -= 1;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} | 1 |
public AlignmentAction(String nm, int alignment) {
super(nm);
m_alignment = alignment;
String icon;
switch (alignment) {
case StyleConstants.ALIGN_RIGHT:
icon = "align_right16.gif";
break;
case StyleConstants.ALIGN_LEFT:
icon = "align_left16.gif";
brea... | 4 |
public void createRotation(int centerX, int centerY, float angle, Roi roi)
/*
Put a rotation (over angle) flow field in flow, and
include the part within the current ROI.
Only the v.v within the roi will be valid.
*/
{
Rectangle r=null;
if (roi instanceof Roi)
r = roi.getBoundingRect();... | 9 |
public static final Object getLoadNewClassInstance(final CMObjectType classType, final String path, final boolean quiet)
{
if((path==null)||(path.length()==0))
return null;
try
{
final String pathLess=makeDotClassPath(path);
if(classes.containsKey(pathLess))
return (classes.get(pathLess)).newInstanc... | 7 |
@Override
public void valueUpdated(Setting s, Value v) {
String setting = s.getName();
if (setting.equals(Text)) {
if (!loopFlag_) {
loopFlag_ = true;
if (textArea_ != null && v != null)
textArea_.setText(v.getString());
} else
loopFlag_ = false;
} else if (setting.equals(Trigger)) {
tr... | 9 |
public void unFlagAll(){
unFlag();
if(children!=null){
children.get(0).unFlagAll();
children.get(1).unFlagAll();
}
} | 1 |
private static void runText(String args[])
{
GameEngine engine = new GameEngine("mosquito.xml");
// TextInterface ti = new TextInterface();
// ti.register(engine);
// ti.playGame();
if(args.length < 7)
{
printUsage();
System.exit(-1);
}
Text t = new Text(engine);
engine.getConfig().setSelected... | 4 |
@Override
public PermissionType getType() {
return PermissionType.OP;
} | 0 |
String ChangeExcitationFilter(int Current_Item){
int Move_Item=Current_Item;//-Global.Exci_Previous_Item;
//if (Move_Item<0) {Move_Item=Move_Item+6;}
String CI=Integer.toString(Current_Item);
Global.Exci_Previous_Item=Current_Item;
try{
if (Move_It... | 7 |
@Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((affected!=null)
&&(affected instanceof MOB)
&&(msg.amISource((MOB)affected)||msg.amISource(((MOB)affected).amFollowing())||(msg.source()==invoker()))
&&(msg.sourceMinor()==CMMsg.TYP_QUIT))
{
... | 7 |
public final Collection getCollection(Identifier ident) {
if (ident instanceof PackageIdentifier)
return packs;
else if (ident instanceof ClassIdentifier)
return clazzes;
else if (ident instanceof MethodIdentifier)
return methods;
else if (ident instanceof FieldIdentifier)
return fields;
else if (... | 5 |
private boolean readProperties(Properties props) {
//Use Proxy
if("true".equals(props.getProperty(USE_PROXY))) {
useProxy_flag = true;
}
else {
useProxy_flag = false;
}
//HTTP Settings
httpProxyHost = props.getProperty(HTTP_PROXY_HOST);
... | 8 |
final Class367 method3832(int i, byte i_58_) {
anInt9900++;
if (i_58_ >= -57)
method3832(-96, (byte) 20);
int i_59_ = i;
while_237_:
do {
do {
if ((i_59_ ^ 0xffffffff) != -4) {
if ((i_59_ ^ 0xffffffff) != -5) {
if ((i_59_ ^ 0xffffffff) == -9)
break;
break while_237_;
}
} e... | 6 |
public static Generation initFirstGeneration(List<Element> items, int sop) {
Generation gen = new Generation();
for (int i = 0; i < sop; i++) {
Chromosome chromosome = new Chromosome();
chromosome.insertRandom(items);
gen.addChromosome(chromosome);
}
return gen;
} | 1 |
public List<String> fetchCategories(String userId, String type){
List<String> unsubCat = new ArrayList<String>();
ResultSet rs=null;
Connection con=null;
PreparedStatement ps=null;
List<String> result=new ArrayList<String>();
try{
String sql;
if(type.equals("NotSubscribed")){
sql="SELECT DISTI... | 9 |
private void lastNameTextFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_lastNameTextFieldKeyTyped
lastNameLabel.setForeground(Color.black);
int strLength = lastNameTextField.getText().length();
char c = evt.getKeyChar();
if (strLength == 30 || !(Character.isAlphabetic(c) |... | 5 |
public void setCharSet(String charSet) {
this.charSet = charSet;
} | 0 |
private void buildTabs(){
// Get the active games
byte[] activeGameIds = GameFactory.getActiveGameIds();
// Only run when the active games has changed
if(Arrays.equals(activeGameIds, activeGames))
return;
// Store the active games
activeGames = activ... | 8 |
@Override
protected void waitTillProcessingDone() {
if (inferenceWorker == null) {
return;
}
if (inferenceWorker.isDone()) {
return;
}
while (true) {
synchronized (inferenceWorker) {
try {
inferenceWorker.wait(10);
} catch (InterruptedException ie) {
... | 5 |
public int longestCommonSubsequence(String A, String B) {
// write your code here
if(A == null || A.length() == 0 || B == null || B.length() == 0) {
return 0;
}
int lenA = A.length();
int lenB = B.length();
int[][] commonS = new int[lenA+1][lenB+1];
for(i... | 9 |
void setInputs(GtexExperiment gtexExperiment) {
Gtex gtex = gtexExperiment.getGtex();
for (String gid : gtex.getGeneIds()) {
List<Entity> entities = entitiesByGeneId.get(gid);
if (entities != null) {
double value = gtexExperiment.getValue(gid);
if (!Double.isNaN(value)) {
for (Entity e : entiti... | 4 |
private Set<String> getUserName() {
HashSet<String> returnset = new HashSet<String>();
Iterator<Session> iterator = chatroomUsers.iterator();
while (iterator.hasNext()) {
returnset.add(iterator.next().getUserProperties().get("username").toString());
}
System.out.print... | 1 |
@Override
public List<JDK> loadDefaultJDKOnSystem() throws LoadDefaultJDKException, DefautJDKInstalledNotFoundException {
String fincCommand = "find /usr/local/java/ -name javac";
ArrayList<JDK> list = new ArrayList<JDK>();
try {
List<String> commands = new ArrayList<String>();
commands.add("bash");
... | 6 |
public void paste() throws ShareException {
if (filelist == null)
throw new ShareException(ShareException.Error.FILELIST_NOT_YET_SET);
if (pwd == null)
pwd = filelist;
if (cut_buffer == null)
throw new ShareException(ShareException.Error.NOTHING_TO_PASTE);
if (pwd.equals(cut_buffer))
throw new ... | 8 |
public void print1(String name) {
synchronized (this) {
for (int i = 0; i < 20; i++) {
System.out.printf("%s %s\n", name, i);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
} | 2 |
@Override
public ArrayList<Move> generateMovesForThisPiece(Chessboard chessboard) {
final String positionPiece = chessboard.getPositionPiece(this);
final int getX = Helper.getXfromString(positionPiece);
final int getY = Helper.getYfromString(positionPiece);
int toX = getX, toY = getY;
// Avance d'une case
... | 9 |
public static void main(String[] args) {
try {
UserDAO wtf = new UserDAO();
wtf.removeAll();
RoleDAO wth = new RoleDAO();
wth.removeAll();
User u = createUsers();
// showAllUser();
Role r = createRoles();
// showAll... | 1 |
public static RubyHash buildEnvironment(Ruby runtime, HttpServletRequest req) throws IOException {
RubyHash env = new RubyHash(runtime);
log.debug("Creating Rack environment");
env.put(runtime.newString(REQUEST_METHOD), runtime.newString(req.getMethod()));
// I can't se... | 8 |
public WebFrame(String myHtmlFile) {
setTitle("Help Browser");
JPanel mainpanel = new JPanel(new BorderLayout());
Hyperactive hyper = new Hyperactive();
myBrowserDisplay.setEditable(false);
myBrowserDisplay.addHyperlinkListener(hyper);
JScrollPane htmlscrollpane = new JScrollPane(myBrowserDisplay);
mainp... | 2 |
public void fill(int xPos, int yPos, int w, int h, int col, int amount){
for(int y = 0; y < h; y++){
int yPix = y+yPos;
if(yPix < 0 || yPix >= height)continue;
for(int x = 0; x < w; x++){
int xPix = x+xPos;
if(xPix < 0 || xPix >= width)continue;
int merged = merge(col, pixels[xPix + yPix * wi... | 6 |
@Override
public List<Message> make(Message oMsg, Parse parse) {
ArrayList<Message> sMsgs = new ArrayList<Message>();
// 送信許可
AuthorizeSender as = new AuthorizeSenderImpl(parse.getDomBundle(), parser, oMsg.getSender());
if (!as.isAuthorized()) {
MakeWarning mw = new MakeWarningImpl();
sMsgs.add(... | 7 |
public float getFactor(){
switch(this){
case grams:
return 1;
case kilograms:
return 1000;
case ounces:
return .03527396211f;
case pounds:
return 453.59233f;
case fluidOunces:
return 1;
case pints:
return 16;
case quarts:
return 32;
case gallons:
return 128;
case liters:
r... | 9 |
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.