text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void evaluateInput(String message) throws Exception {
// Parse the input message
Matcher matcher = pattern.matcher(message);
if (matcher.matches() == false) {
throw new IllegalArgumentException(
"Syntax error: " + message);
}
... | 9 |
public void connect(Message m) {
String message = m.getMessage();
if (message.startsWith(Protocol.CONNECT)) {
message = message.replace(Protocol.CONNECT, "");
if (!message.equals("")) {
if (!users.containsValue(m.getIClient())) {
m.getIClient()... | 3 |
@Override
public ArrayList<? extends Object> getOptions() {
if (options == null) {
options = new ArrayList<Source>();
for (Source s : Source.values())
options.add(s);
}
return options;
} | 3 |
public static void main(String[] args) {
logger.setLevel(Level.SEVERE);
ConsoleHandler handler = new ConsoleHandler();
handler.setLevel(Level.SEVERE);
logger.addHandler(handler);
if (args.length == 0) {
logger.warning("Invalid arguments count.");
return;
... | 6 |
@EventHandler
public void PlayerHunger(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.getPlayerConfig().getDouble("Player.Hunger.D... | 6 |
@Override
public State run(final String program, final State s) {
Map<String, Integer> methodMap = Utils.getMethods(program);
ClassWriter cw = new ClassWriter(0);
MethodVisitor mv;
final String stateClass = Type.getInternalName(s.getClass());
cw.visit(V1_6, ACC_PUBLIC + ACC_... | 7 |
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.HIGHEST)
public void onInventoryClick(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
// sprawdza czy to inventory tego pluginu
if(event.getInventory().getName().equalsIgnoreCase(this.plugin.dInvName)) {
... | 8 |
public static void main(String[] args)
{
if (args.length == 1)
{
try
{
echoTCP(args[0]);
}
catch (IOException e)
{
e.printStackTrace();
System.exit(1);
}
}
else if... | 5 |
public static void dump(DataInputStream ios, int length) {
try {
String s;
String a = "";
for (int i = 0, j = 0; i < length; i++) {
int val = ios.read();
if (val < 0) System.exit(0);
if (j == 0) {
System.out.println(" " + a);
... | 9 |
protected int processRecord (int recordCounter, byte[] recordData, short recordAttributes, int recordUniqueID)
{
// TBD
// if (Outliner.DEBUG) { System.out.println
// ("\tStan_Debug:\tPdbReaderWriter:processRecord for record #" + (recordCounter+1)); }
return SUCCESS ;
} // end protected method ... | 0 |
public Integer insert(ProductosBeans producto) throws DAOException {
PreparedStatement pst = null;
ResultSet generatedKeys = null;
try {
pst = con.prepareStatement(sql.getString("INSERT_PRODUCTOS"),
Statement.RETURN_GENERATED_KEYS);
pst.setString(1, producto.getNombreP());
pst.setString(2, p... | 7 |
public void talk(String msg) {
System.out.println(msg + "!你好,我是" + username + ",我年龄是" + age);
} | 0 |
public void addBuilding(CastleBuilding b)
{
if (b.type == null || b.type == type) {
if (!buildings.contains(b)) {
buildings.add(b);
b.buyBonus(Mission.getLastInstance().getActivePlayer(), this);
System.out.println("ADD BUILDING: "+b.name);
}
}
} | 3 |
protected java.util.List<ThreeTuple<Vector2, Vector2, Vector2>> parse(BufferedImage image) {
ArrayList<ThreeTuple<Vector2, Vector2, Vector2>> ret = new ArrayList<ThreeTuple<Vector2, Vector2, Vector2>>();
int imageWidth = image.getWidth();
int imageHeight = image.getHeight();
// boolean v... | 4 |
public static void printList(ListNode x) {
if(x != null){
System.out.print(x.val + " ");
while (x.next != null) {
System.out.print(x.next.val + " ");
x = x.next;
}
System.out.println();
}
} | 2 |
public void update() {
for (int i = 0; i < players.size(); i++) {
players.get(i).update();
}
for (int i = 0; i < entities.size(); i++) {
entities.get(i).update();
}
for (int i = 0; i < projectiles.size(); i++) {
projectiles.get(i).update();
... | 3 |
public boolean subComponentOf(GUIComponentGroup componentGroup) {
if (this == componentGroup) {
return true;
}
if (this.superGroup == null) {
return false;
}
return this.superGroup.subComponentOf(componentGroup);
} | 2 |
private void init() {
this.x.set(0.);
/*
* Set up y for the first Lanczos vector. y and beta1 will be zero
* if b = 0.
*/
this.r1 = this.b.copy();
this.y = this.minv == null ? this.b.copy() : this.minv.operate(this.r1);
i... | 9 |
static final public void operadores_aritmetico() throws ParseException {
trace_call("operadores_aritmetico");
try {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ATRIBUICAO:
jj_consume_token(ATRIBUICAO);
break;
case ADICAO:
jj_consume_token(ADICAO);
break;
... | 7 |
@Override
public void batimentToFarm(Farm farm, List<Batiment> batiments) {
for(Batiment batiment:batiments){
batiment.setFarm(farm);
em.persist(batiment);
}
} | 1 |
public String toString() {
if (comment != null) {
return "label_" + index + " (" + comment + ")";
} else {
return "label_" + index;
}
} | 1 |
public static String numberToString(Number number) throws JSONException {
if (number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
if (string... | 6 |
private void switchProcess() {
Process process = cpu.getActiveProcess();
if(process != null){
process.leftCpu(clock);
cpu.addProcess(process);
process.enterCpuQueue(clock);
statistics.nofForcedProcessSwitch++;
}
process = cpu.startNextProcess();
if(process != null){
process.enterCpu(clock);
... | 5 |
private Supervisor(){} | 0 |
public Boolean eliminarProducto(String producto){
if(!this.stock.containsKey(producto)){
return false;
}
this.stock.remove(producto);
return true;
} | 1 |
private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... | 5 |
public void cleanOldNatives() {
File root = new File(mcPath, "versions/");
//this.launcher.println("Looking for old natives to clean up...");
IOFileFilter ageFilter = new AgeFileFilter(System.currentTimeMillis() - 3600L);
for (File version : root.listFiles((FileFilter) Director... | 2 |
void executePlayerCommand(PlayerCommand pc, int playerNumber)
{
int command = pc.command;
Player p;
if (playerNumber == 1)
p = server.gameState.player1;
else
p = server.gameState.player2;
switch (command)
{
case PlayerCommand.PRESS_RIGHT : p.run_right();
... | 7 |
public void act() {
if(debut) {
debut = false;
ActionFactory.wait(10000, "end", true);
}
if(!clawsMoving) {
if(attente) {
ActionFactory.wait(500, "claws", true);
}
else {
clawsMoving = true;
ActionFactory.useClaws(nextclawsOpenure, true);
}
}
if(!robotMoving) {
robotMoving = t... | 8 |
public Organism getRepresentOrganism() {
if (getOrganisms().isEmpty()) {
System.err.println(this.toString());
}
return getOrganisms().get(representativeIndex);
} | 1 |
@Override
public double[] calculateJulia3DWithoutPeriodicity(Complex pixel) {
iterations = 0;
Complex tempz2 = new Complex(init_val2.getPixel(pixel));
Complex[] complex = new Complex[3];
complex[0] = new Complex(pixel);//z
complex[1] = new Complex(seed);//c
... | 9 |
@Override
public Set<DeliveryOption> call() throws Exception
{
Set<DeliveryOption> xs = new HashSet<>();
String city_name = null;
Region r;
if(rx.delivery != null)
while((r = rx.delivery.getRegion()) != null)
if(r.getType() == RegionType.CITY)
{
city_name = r.getName();
break;
}
if... | 4 |
private static MaNode makeNode(Composante c) {
Type t = c.getType();
switch (t) {
case RESISTANCE:
int image = MaNode.NODE_RESISTANCE;
Resistance resis = (Resistance) c;
if (resis.isBurned()) {
image = MaNode.NODE_BURNED;
... | 6 |
@Override
public void affectCharState(MOB mob, CharState state)
{
super.affectCharState(mob,state);
if(mob.baseCharStats().getCurrentClass().ID().equals(ID()))
{
Ability A=null;
for(int a=0;a<mob.numAbilities();a++)
{
A=mob.fetchAbility(a);
if((A!=null)
&&((A.classificationCode()&Ability.AL... | 8 |
public static String getRepeatString(int repeatTime, String metaString)
{
String repeatString = null;
if ((repeatTime > 0) && (metaString != null)) {
int intMetatStringLength = metaString.length();
if (intMetatStringLength == 0) {
repeatString = "";
} else {
StringBuffer temp... | 4 |
public static void startupGoalCaches() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((M... | 7 |
public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... | 7 |
private Meeting getMeetingFromID(int id) {
Iterator meetingIterator = allMeetings.iterator();
Meeting nextMeeting;
while(meetingIterator.hasNext()) {
nextMeeting = (Meeting) meetingIterator.next();
if(nextMeeting.getId() == id) {
return nextMeeting;
... | 2 |
public void getMoveTarget() {
if(Application.get().getLogic().getGame().getSector(currentSector) != null) {
EnemyLocation loc = Application.get().getLogic().getGame().getSector(currentSector).getBossLocation();
if(loc != null) {
targetX = loc.x();
targetY ... | 2 |
public static int[] decompileNumberInFactors(int numToDecompile){
if (isNumberFirst(numToDecompile)){
return new int[]{numToDecompile};
}
List<Integer> list = new ArrayList<Integer>();
int divisor = 0;
while (divisor < numToDecompile){
divisor++;
... | 5 |
public void mouseDragged(MouseEvent e) {
if (!editable)
return;
if (!boardBox.contains(e.getPoint()))
return;
if (lastLineStart == null)
lastLineStart = e.getPoint();
else if (lastLineStart != null
&& e.getPoint().distance(lastLineStart) > 3) {
lastLine = new Line2D.Double(Board.fromScreenSpace(... | 5 |
@Test public void testUpgradeWriteDeadlock() throws Exception {
System.out.println("testUpgradeWriteDeadlock constructing deadlock:");
LockGrabber lg1Read = startGrabber(tid1, p0, Permissions.READ_ONLY);
LockGrabber lg2Read = startGrabber(tid2, p0, Permissions.READ_ONLY);
// allow read locks to acquir... | 8 |
public String getValueAsString() {
if (value == null)
return null;
logger.debug("field is " + this.getName() + " and val is |" + value + "|");
switch (type) {
case DAOutils.STRING_TYPE:
if (this.getHtmlType() == DAOutils.Y_OR_N) {
return ((String) value).trim().equalsIgnoreCase("Y") ? "Y" : "N";
... | 9 |
public void flush(){
LinkedList<PlayerReinforcement> toSave = new LinkedList<PlayerReinforcement>();
LinkedList<PlayerReinforcement> toDelete = new LinkedList<PlayerReinforcement>();
for (PlayerReinforcement pr : pendingDbUpdate) {
if (pr.getDbAction() == DbUpdateActi... | 4 |
@Override
public void afterPhase(PhaseEvent event) {
// TODO Auto-generated method stub
System.out.println("Inside phase listner");
FacesContext facesContext = event.getFacesContext();
String currentUser = facesContext.getViewRoot().getViewId();
boolean isLoginPage = (currentUser.lastIndexOf("index.jsp") > ... | 5 |
private static void loadFinished(HashSet<Long> finished) throws Exception {
ArrayList<File> finishedList = new ArrayList<File>(Arrays.asList(new File("./Finished/").listFiles()));
int cnt = 0;
for (File file : finishedList) {
BufferedReader buff = new BufferedReader(new FileReader(file));
String id;
int ... | 2 |
@Override
protected void xMovement(double time) {
if (!xObstacleAhead(time)) {
if (currentCoord.getX() + 30 > 800) {
if (AppFrame.incFrameNumber()) {
currentCoord.setX(0);
} else {
gameOver = true;
}
... | 6 |
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://... | 6 |
private void onOpen() {
logger.fine("socket open");
this.readyState = ReadyState.OPEN;
Socket.priorWebsocketSuccess = WebSocket.NAME.equals(this.transport.name);
this.emit(EVENT_OPEN);
this.flush();
if (this.readyState == ReadyState.OPEN && this.upgrade && this.transport... | 4 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Piece other = (Piece) obj;
if (canCastle != other.canCastle)
return false;
if (color != other.color)
return false;
if (x != other.x)
... | 7 |
static public OTAMessageIntf recv(DataInputStream input) throws Exception{
OTAMessageIntf msg = null;
int ret = 0;
try {
byte [] header_temp = new byte[header_size];
ret = input.read(header_temp);
if(ret == -1)
throw new Exception ("Socket read failed - header");
OTA... | 9 |
public static Stella_Object uMinusConstraint(IntegerWrapper missingArgument, DimNumberLogicWrapper x1, DimNumberLogicWrapper x2, DimNumberLogicWrapper x3) {
{ Stella_Object value = null;
switch (missingArgument.wrapperValue) {
case -1:
value = (Stella_Object.eqlP(((DimNumber)(x1.wrapperVal... | 8 |
public RPC() {
setupEventListeners();
/**
* Thread will endlessly call executeNext() method
*/
// TODO: Move out from RPC
thread = new Thread(new Runnable() {
@Override
public void run() {
while (true) {
... | 3 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Projet)) {
return false;
}
Projet other = (Projet) object;
if ((this.num == null && other.num != null) || (this... | 5 |
public void act() {
jMan.act(this);
jMan.setActed(true);
// Make every other piece act.
for (int i= 0; i < width; i= i+1){
for (int j= 0; j < height; j= j+1){
Piece p= board[i][j];
if (p != null && !p.hasActed()){
... | 7 |
private boolean objectSelection(FrameBuffer buffer) {
PhysObject3D obj;
SimpleVector objCenBuf;
SimpleVector objBound;
SimpleVector shiftCenObj;
Enumeration<PhysObject3D> objs = gameWorld.getWorld().getObjects();
... | 7 |
private static void readXmlData() {
setXmlFolder();
accountings = new Accountings(xmlFolder, xslFolder, htmlFolder);
if(!xmlFolder.exists()){
xmlFolder.mkdirs();
}
File subFolder = new File(xmlFolder, Accountings.ACCOUNTINGS);
if(!subFolder.exists()){
... | 3 |
private synchronized void check(MarketState ms) throws InvalidMarketStateTransition {
if (state == MarketState.CLOSED) {
if (ms == MarketState.OPEN) {
throw new InvalidMarketStateTransition("InvalidMarketStateTransition: Market cannot go directly from CLOSED to OPEN.");
}... | 9 |
public Dumper(InputStream cramIS, ReferenceSource referenceSource, int nofStreams, String fastqBaseName,
boolean gzip, long maxRecords, boolean reverse, int defaultQS, AtomicBoolean brokenPipe)
throws IOException {
this.cramIS = cramIS;
this.referenceSource = referenceSource;
this.maxRecords = maxReco... | 8 |
public static void main(String[] args) {
Path zipFile = Paths.get("/home/xander/test/zippy.zip");
Path jarFile = Paths.get("/home/xander/test/zippy.jar");
try (FileSystem zipFileSys = FileSystems.newFileSystem(zipFile, null)) {
Files.deleteIfExists(Paths.get("/home/xander/test/passa... | 1 |
@Override
@Command
public MessageResponse readQuorum() throws IOException {
if(initRMI()) return proxyRMI.readQuorum();
else return new MessageResponse("Cannot connect to Proxy via RMI");
} | 1 |
private double[] calculateCognitiveVelocity(int particle, double r1) {
double[] cognitiveVelocity = new double[position[particle].length];
for(int k = 0; k < cognitiveVelocity.length; k++){
cognitiveVelocity[k] = cognitiveConstant * r1 * (personalBest[particle][k] - position[particle][k]);
}
return cognitive... | 1 |
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
Entity entity = event.getEntity();
if (entity instanceof Player) {
xAuthPlayer xp = plyrMngr.getPlayer(((Player) entity).getName());
if (plyrMngr.isRestricted(xp, event))
... | 2 |
private void handleAction() {
if (actionButton.getText().equals("Find IP")) {
Integer ip = dnsDB.findIP(nameText.getText());
if (ip == null) {
JOptionPane.showMessageDialog(GUI.this,
"Could not find an IP address with host name: "
+ nameText.getText());
} else {
ipText.setText(DNSDB.IPT... | 8 |
public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, IOException {
if(args.length == 0) {
Updater.update();
} else {
new File("Updater.jar").delete();
}
os = System.getProperty("os.name").toLowerCase().con... | 8 |
public final double grad(int par1, double par2, double par4)
{
int j = par1 & 15;
double d2 = (double)(1 - ((j & 8) >> 3)) * par2;
double d3 = j < 4 ? 0.0D : (j != 12 && j != 14 ? par4 : par2);
return ((j & 1) == 0 ? d2 : -d2) + ((j & 2) == 0 ? d3 : -d3);
} | 5 |
public ArrayList<ObjectMap> listeObjet (){
ArrayList<ObjectMap> l = new ArrayList<ObjectMap>();
for(int i = 0 ; i < this.personne.size(); i++){
l.add((ObjectMap)this.personne.get(i));
}
if(this.objet != null){
l.add(this.objet);
}
return l;
} | 2 |
@Override
public void update() {
Action action = this.ctrl.action(this.game);
d.rotate(action.turn*STEER_RATE*Constants.DT);
//calc new v
v.add(d, MAG_ACC*Constants.DT*action.thrust);
v.mult(LOSS);
s.add(v, Constants.DT);
s.wrap(Constants.WORLD_WIDTH, Constants.WORLD_HEIGHT);
if (acti... | 9 |
public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} | 6 |
public static Matrix createSubMatrix(Matrix matrix, int excluding_row, int excluding_column) {
int rows = matrix.getRowDimension();
int columns = matrix.getColumnDimension();
Matrix subMatrix = new Matrix(rows - 1, columns - 1);
int r = -1;
for (int i = 0; i < rows; ++i) {
... | 4 |
public void characters(char buf[], int offset, int len) throws SAXException {
String s = new String(buf, offset, len);
if (!s.trim().equals("") && importType == "STRANGEBREW") {
// SBWin uses gr instead of g, fix it:
if (s.trim().equalsIgnoreCase("gr"))
s="g";
sbCharacters(s.trim());
}
else if (... | 5 |
public final int getBits() { return bits; } | 0 |
public ItemList() {
setTitle("Item List");
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setBounds(100, 100, 325, 500);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
contentPanel.setLayout... | 2 |
@Override
public void gameRenderMobs() {
} | 0 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GeoPoint geoPoint = (GeoPoint) o;
if (Double.compare(geoPoint.lat, lat) != 0) return false;
if (Double.compare(geoPoint.lon, lon) != 0) return ... | 5 |
public Object clone() {
try {
VariableSet other = (VariableSet) super.clone();
if (count > 0) {
other.locals = new LocalInfo[count];
System.arraycopy(locals, 0, other.locals, 0, count);
}
return other;
} catch (CloneNotSupportedException ex) {
throw new alterrs.jode.AssertError("Clone?");
}... | 2 |
public void addControlLogic() {
addButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (commandPanel != null) {
String filter = commandPanel.getCommandLine();
chainPanel.addFilter(filter);
}
}
});
insertAboveButton.addActionListener(new ActionList... | 4 |
private void runRouteCalculation()
{
if (fromNode != null && toNode != null)
{
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
wGraph.runDij(fromNode, toNode, isFastestRoute);
if (wGraph.hasRoute(toNode))
{
mapComponent.setRouteNodes(wGraph.calculateRoute(toNode));
printRoute.setEnab... | 3 |
public void setCount(Integer count) {
this.count = count;
} | 0 |
StringBuilder makeTotalScoreLine() {
StringBuilder stringBuilder = new StringBuilder();
calcScore();
if (nowFrame == 0) {
if (frameList.get(nowFrame).isFirstShotStrike())
stringBuilder.append(makeEachFrameScore(nowFrame));
else if (frameList.get(nowFrame)... | 7 |
private static void createAndShowGUI() {
// GUI Look And Feel
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception ignored) { }
JFrame frame = new JFrame("JCount");
frame.setLayout(new GridLayout(NUM_PANELS, 1));
for (int i = 0; i < NUM_PANELS; i++) {
JC... | 2 |
public static void main(String[] args) {
try (Scanner scanner = new Scanner(System.in)) {
System.out.print("Geef de maand die onderzocht wordt (getal van 1 tot 12)");
int maand = scanner.nextInt();
if (maand >= 1 && maand <= 12) {
try (Connection connection = ... | 4 |
private double arrondir(double nombre) {
if(nombre != Double.NEGATIVE_INFINITY && nombre != Double.POSITIVE_INFINITY && nombre != Double.NaN){
double n = nombre * Math.pow(10, arrondissement);
n = Math.round(n);
n = n / Math.pow(10, arrondissement);
return n;
... | 3 |
private int animationToInt(AllEnum.AnimationCommands commands){
if(commands == AllEnum.AnimationCommands.PUNCH1){
return 1;
}
if(commands == AllEnum.AnimationCommands.PUNCH2){
return 2;
}
if(commands == AllEnum.AnimationCommands.KICK1){
... | 8 |
@DataProvider(name = "neighbors")
public Object[][] neighborsData() {
List<Object[]> neighbors = new ArrayList<Object[]>();
for (int a = 0; a < 2; a++) {
for (int b = 0; b < 2; b++) {
for (int c = 0; c < 2; c++) {
for (int d = 0; d < 2; d++) {
for (int e = 0; e < 2; e++) {
for (int f = 0;... | 9 |
private boolean judgeConverge (int color) {
Matrix[] lambdaMat = lambda.getMatrix();
Matrix[] diagMat = diag.getMatrix();
Matrix[] residueMat = residue.getMatrix();
double diff = reshapedProductUVBaseMat[color].times(diagMat[color]).plus(residueMat[color]).minus(stackedToOneColMat[color... | 1 |
public TuringTrimmingTester(String filename)
{
int index=0;
Scanner sc;
prods=new Production[42];
try {
sc = new Scanner(new File(filename));
while (sc.hasNextLine())
{
String line=sc.nextLine()+" ";
String[] aa=line.split("->");
Production p=new Production(aa[0], aa[1]);
prods[index]=... | 3 |
public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and fe... | 6 |
public Boolean process() {
// Admin permission
if(!plugin.permission.canCreate(player)) {
noPermission();
return true;
}
// Valid command format
if(args.length == 2) {
// List slot machines
if(args[1].equalsIgnoreCase("slots")) {
sendMessage("Registered slot machines:");
for... | 8 |
public MiniXMLToken getTokenAttributeName(MiniXMLToken oMiniXMLToken) {
oMiniXMLToken.setType(tAttrName);
while (true) {
if (!isNameChar(testNext()))
return oMiniXMLToken;
oMiniXMLToken.append(getNext());
}
} | 2 |
public void rotarAtrasDerecha() {
if (direccion.equals(Direccion.derecha)) {
rotar(tipoTrans.enZ, -45);
} else if (direccion.equals(Direccion.adelante)) {
rotar(tipoTrans.enZ, -135);
} else if (direccion.equals(Direccion.atras)) {
rotar(tipoTrans.enZ, 45);
... | 7 |
private static CategoryDataset getDataSet() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(100, "北京", "苹果");
dataset.addValue(100, "上海", "苹果");
dataset.addValue(100, "广州", "苹果");
dataset.addValue(200, "北京", "梨子");
dataset... | 0 |
public String getContent(){
return this.content;
} | 0 |
private MyGraph greedyCoverRandom(MyGraph network, double factor) {
ArrayList<MyEdge> candidateEdges = new ArrayList<MyEdge>(
network.getEdges());
for (MyEdge edge : candidateEdges) {
double w = edge.getWeight() + factor;
edge.setWeight(w);
}
ArrayList<MyEdge> chosenEdges = new ArrayList<MyEdge>();
... | 7 |
public String getNewVariableThatBelongsInLambdaSet(Grammar grammar,
Set lambdaSet) {
String[] variables = grammar.getVariables();
for (int k = 0; k < variables.length; k++) {
if (!isInLambdaSet(variables[k], lambdaSet)
&& belongsInLambdaSet(variables[k], grammar, lambdaSet))
return variables[k];
}
... | 3 |
@Override
public void keyPressed(KeyEvent ke) {
switch (ke.getKeyCode()) {
case KeyEvent.VK_UP:
keyState[KeyCode.UP.ordinal()] = true;
break;
case KeyEvent.VK_DOWN:
keyState[KeyCode.DOWN.ordinal()] = true;
break;
case KeyEvent.VK_LEFT:
keyState[KeyCode.LEFT.ordinal()] = true;
break... | 8 |
static boolean isBoolean( String var ) {
if(
var.equalsIgnoreCase("true") ||
var.equalsIgnoreCase("false") ||
var.equals("1") ||
var.equals("0") ||
var.matches("^[tT].*$") ||
var.matches("^[fF].*$") ) {
return true;
}
return false;
} | 6 |
public static BiCubicSpline[] oneDarray(int nP, int mP, int lP){
if(mP<3 || lP<3)throw new IllegalArgumentException("A minimum of three x three data points is needed");
BiCubicSpline[] a =new BiCubicSpline[nP];
for(int i=0; i<nP; i++){
a[i]=BiCubicSpline.zero(mP, lP);
}
... | 3 |
public void processPacket(String received) {
stringParts = received.split(" ");
try {
// auction- ended- notification
if (stringParts[0].equals("!auction-ended")) {
String describtion = "";
// user is the highest bidder
if (username.equals(stringParts[1].trim())) {
for (int i = 3; i < st... | 9 |
public void setDefinition(String definition) {
// JavaMetadata will extract all modifiers for us
JavaMetadata metadata = new JavaMetadata(definition);
modifier = metadata.getModifier();
definition = metadata.getClassName();
context.getImports().addImports(metadata.getImports());
// Add any generics extra... | 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.