method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
27ebfde3-a4a4-43d8-b994-937453290a5a | 8 | @Override
public void grantAbilities(MOB mob, boolean isBorrowedClass)
{
final boolean allowed=CMSecurity.isAllowedEverywhere(mob,CMSecurity.SecFlag.ALLSKILLS);
if((!allowed)&&(mob.playerStats()!=null)&&(!mob.playerStats().getSecurityFlags().contains(CMSecurity.SecFlag.ALLSKILLS,false)))
{
final List<String>... |
64370e12-7ccd-49ed-8c8f-b242bb5248c7 | 7 | public AutoHideExpandPanel() {
super(new BorderLayout());
if(! DockingPreferences.isLightWeightUsageEnabled()) {
this.heavyPanel = new Panel(new BorderLayout());
}
if(AutoHidePolicy.getPolicy().getExpandMode() == AutoHidePolicy.ExpandMode.EXPAND_ON_ROLLOVER) {
expansionTimer = new Timer(AutoHidePolicy.g... |
6ad240d7-4a23-4a2f-8c71-11f2d0177dfa | 3 | public int initTimenode(int owner) {
Timenode node = new Timenode();
node.setDisplay("true");
node.setEvent_headnode(0);
node.setNextnode(0);
node.setTime_description("世界诞生");
node.setTime_owner(owner);
int newid = 0;
conn = SQLconnect.getConnection();
ResultSet res;
try {
String sql = String
... |
f15c3a8b-a1c0-4281-b77a-94ec4b79d41e | 7 | private static boolean hitHealMonster(Player p, ArrayList<Monster> monsters, int whichMonster, boolean atRange) {
ArrayList<String> rAttacks = new ArrayList<String>();
for(int i = 0; i < p.getUsableRangedAttacks().size(); i++) {
rAttacks.add(p.getUsableRangedAttacks().get(i).toString());
}
ArrayLi... |
6a976046-6da3-43bd-a2d1-6b3e22c23ef1 | 6 | public static int GetLongZipSize(long _num)
{
if(_num > Byte.MIN_VALUE && _num < Byte.MAX_VALUE)
return 2;
else if(_num > Short.MIN_VALUE && _num < Short.MAX_VALUE)
return 3;
else if(_num > Integer.MIN_VALUE && _num < Integer.MAX_VALUE)
return 5;
... |
773c7c15-1009-47c2-b076-7c1417898a70 | 5 | @Override
public void append(Element element, String outerBlockNames)
throws RemoteException {
String editBlString = null;
if(CheckOuterBlockNames(outerBlockNames)){
throw new RemoteException("outerBlockNames is not correct,outerBlockNames ="+outerBlockNames);
}
if((null == element.toString()... |
1a69aa9d-3caf-4333-8589-89c96e49875c | 4 | private boolean seekEOL() {
// Set maximum and current bit index into the compressed data.
int bitIndexMax = data.length * 8 - 1;
int bitIndex = bytePointer * 8 + bitPointer;
// Loop while at least 12 bits are available.
while (bitIndex <= bitIndexMax - 12) {
// Get the next 12 bits.
int next12Bits = n... |
7656e56a-b5c7-455c-99cb-38acf38a0d8c | 5 | private boolean checkHorizontal(CellState player, int col, int row) {
int minCheck = col - (model.getWinLength() - 1);
int maxCheck = col + (model.getWinLength() - 1);
if (minCheck < 0) {
minCheck = 0;
}
if (maxCheck > model.numOfColumns() - 1) {
maxCheck = model.numOfColumns() - 1;
}
// check w... |
49667579-96f1-4415-83b8-8416947c8d51 | 2 | private ArrayList<Node<Word>> levelOrderTraversal(Node<Word> rt)
{
int index = 0;
ArrayList<Node<Word>> nodes, result;
nodes = new ArrayList<Node<Word>>();
result = new ArrayList<Node<Word>>();
Node<Word> current = rt;
nodes.add(current);
while (index < Math.pow(2,height()+1)-1)
{
current = (Node<W... |
93364c8b-7a18-4b7d-ab09-3628e84f4ede | 0 | public SkipIterator(Iterable<T> source, int count)
{
this._iterator = source.iterator();
this._count = count;
} |
8c5c084d-196d-4bed-bdde-c0e9fa00b1b6 | 4 | public List parseNamesFromFile(File file) throws FileNotFoundException, IOException {
ArrayList<String> companyReps = new ArrayList<String>();
if (file.getName().endsWith("txt")) {
String filename = file.getPath();
//logger.fine("FindNames parsing file " + filename
FileReade... |
68642365-beff-4608-991c-5f7ede60ff1d | 0 | public static Forme P() {
ArrayList<Vecteur> liste = new ArrayList<>();
liste.add(new Vecteur(0, 0));
liste.add(new Vecteur(1, 0));
liste.add(new Vecteur(1, 1));
liste.add(new Vecteur(0, 1));
liste.add(new Vecteur(1, 2));
Vecteur<Integer> _centre = new Vecteur(1, ... |
c723a73c-1ae2-4521-850c-7d6d23d735c1 | 2 | public void mouseReleased(MouseEvent evt) {
if (mousein == 1 && evt.getSource()==close){
Empous.Gov.setStat("freedom", freedom.getValue());
Empous.Gov.setStat("military", military.getValue());
Empous.Gov.setStat("taxes", taxes.getValue());
Empous.Gov.setStat("education", education.getValue());
Em... |
2f1cb867-43b0-46cd-b0ce-52b4ad6780f8 | 6 | public static void main(String[] args) {
ServerSocket myServerSocket;
Socket client;
int connections = 0;
String[] stuff = new String[8];
try {
myServerSocket = new ServerSocket(port);
while (connections < maxConnections) {
client = myServerSocket.accept();
Thread t;
Thread u;
Board b =... |
76adabf4-bb15-4742-88ab-7d0b09d1986f | 7 | public static void printEvaluations(String file, String[] results) {
BufferedWriter output;
FileWriter streamFiles;
try {
streamFiles = new FileWriter(file, true);
output = new BufferedWriter(streamFiles);
if(ReadFromFile.getNumberFromFile(file) < 2) {
for(int i = 0; i < results.length; i++) {
i... |
4eb54578-2868-414c-b628-76cedb7a2c0f | 1 | public static String Xencode(byte[] raw) {
StringBuffer encoded = new StringBuffer();
for (int i = 0; i < raw.length; i += 3) {
encoded.append(encodeBlock(raw, i));
}
return encoded.toString();
} |
edc4cf24-0485-49e4-9047-7de12b5c9a1c | 9 | private String substituteArguments(final FrozenSlice slice, final UserDefinedCommandOrEnvironment commandOrEnvironment,
final UserDefinedCommandOrEnvironmentArgumentSearchResult argumentSearchResult) {
boolean inEscape = false; /* Whether we are in the middle of a character escape */
boolean... |
a0f23aa2-dccf-49c3-a00f-4340409fbed3 | 8 | public boolean act()
{
ArrayList<GravityBall> gBalls = this.getWorld().getGravityBalls();
xAcc = 0;yAcc = 0;
for(GravityBall gBall:gBalls)
{
Point2D.Float c2 = gBall.getCenterPoint();
Point2D.Float c1 = this.getCenterPoint();
double r = c1.distance(c2);
double cY = c2.getY()-c1.getY()... |
ef398bab-1592-456a-baa5-353eb0a169ce | 3 | private final boolean message_ready ()
{
// Destroy content of the old message.
//in_progress.close ();
// Read new message. If there is none, return false.
// Note that new state is set only if write is successful. That way
// unsuccessful write will cause retry on the ... |
75446a71-fead-4721-bf80-4841f4ddb0ee | 2 | public void deposit(BigInteger amount) throws IllegalArgumentException {
if ( (amount == null) || (amount.compareTo(BigInteger.ZERO) <= 0) )
throw new IllegalArgumentException();
setBalance(this.getBalance().add(amount));
} |
49601df1-02e7-4058-a384-a32033f8da74 | 9 | private void initTableSorter(JTable table, AbstractTableModel model)
{
// NOTE 1: this code only works with JDK 1.6 or later
// NOTE 2: since the data is stored as Strings, the data will be
// in String order, not numeric order. This means "1000" < "200"
// instead of 200 < 1000.
... |
e96e510b-d726-45fd-bd37-d115e06c4132 | 5 | public int process(BufferedImage img) {
int width = (img.getWidth() % size != 0) ? img.getWidth() + (size-(img.getWidth() % size)) : img.getWidth();
int height = (img.getHeight() % size != 0) ? img.getHeight() + (size-(img.getHeight() % size)) : img.getHeight();
BufferedImage resized = new BufferedImage(width,... |
65bb0e7d-aaa9-417d-bda2-5af97f367bc3 | 4 | public static boolean hasFullHouse(int[] h) {
boolean threeOfaKind = false;
boolean twoOfaKind = false;
for (int i = 0; i < 13; i++) {
if (h[i] == 2) {
twoOfaKind = true;
}
if (h[i] == 3) {
threeOfaKind = true;
}
... |
c033a7b6-6443-4174-8003-50d1e5bb81b2 | 2 | public void volcarDatos(ArrayList<Prestamos> rows){
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
while(model.getRowCount()>0)model.removeRow(0);
for(Prestamos row : rows){
Object[] fila = {
row.getFecha(),
row.getEstado(), ... |
d276c715-a158-4c51-acaf-5964aad5ff1a | 0 | public static void setMaxLitterSize(int newMAX_LITTER_SIZE)
{
MAX_LITTER_SIZE = newMAX_LITTER_SIZE;
} |
d07fa56d-29c0-489b-96da-2f5ae78d9c76 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(!prereqs(mob,false))
return false;
MOB target=super.getTarget(mob, commands, givenTarget);
if(target == null)
return false;
if(target.fetchEffect(ID())!=null)
{
mob.tell(L("@x1 alr... |
1596935c-9132-4ee7-a2d5-facba9de989c | 4 | public static int[] tpfpfn(HashSet<HashSet<Integer>> orig, HashSet<HashSet<Integer>> computed) {
int tpfpfn[] = new int[3];
int tp = 0;
int fp = 0;
int fn = 0;
for (HashSet<Integer> set : computed) {
if (orig.contains(set)) {
tp++;
} else {... |
c45ccf0f-d282-4421-bcd5-a488d38e5244 | 3 | public void updatePowerups(long time) {
// Loop through all the available enemies
for(int i = 0; i < powerups.length; i++) {
// Try block for safety.
try {
// If the enemy is alive, then let's update it.
if(powerups[i].living == true) { powerups[i].update(time); }
}
// If... |
eb780a06-3228-4715-a9bd-d236038d218f | 4 | @Override
public boolean containsCompound(String name) {
JOSObject<? , ?> raw = this.getObject(name);
if(raw == null) return false;
if(raw.getName().equalsIgnoreCase(COMPOUND_NAME)) return true;
return false;
} |
c8a8de87-03e2-4fe4-8745-b5372876e030 | 8 | @Override
public Funcionario Login(Funcionario funcionario) {
String consulta = "select f from Funcionario f where f.ativo = 1";
String filtro = "";
HashMap<String, Object> param = new HashMap<String, Object>();
if (funcionario != null) {
if ((funcionario.getLogin() !... |
5684777b-7615-44e3-b957-78b2cee81914 | 1 | private String getDoubleValue(final Field field, final Object object) {
Object result = getRawValue(field, object);
if (result == null) {
result = "";
}
return result.toString();
} |
737322b9-facc-43bd-8a59-3f65dba65eaf | 3 | @Override
public int compareTo(UnitsValue<T> other) {
if (this == other) {
return 0;
}
double result = getNormalizedValue() - other.getNormalizedValue();
if (result < 0.0) {
return -1;
}
if (result > 0.0) {
return 1;
}
return 0;
} |
f6ca0764-941a-41cd-801b-553ab653c9c6 | 4 | public boolean tayskasi(){
if(nopat[0].getValue()==nopat[1].getValue()&&nopat[2].getValue()==nopat[4].getValue()){
return true;
}
if(nopat[0].getValue()==nopat[2].getValue()&&nopat[3].getValue()==nopat[4].getValue()){
return true;
}
return false;
} |
78d5901f-8345-4b0c-91a8-8ece2dd3f413 | 7 | private void addParameters()
{
for (int i = 0; i < 10; i += 1)
((OptionalWindow)modWindow).addParameterToSection(visualParameters[i], Text.FRAME_OPTIONAL_SECTION_AI_BEHAVIOUR);
for (int i = 10; i < 19; i += 1)
((OptionalWindow)modWindow).addParameterToSection(visualParameters[i], Text.FRAME_OPTI... |
ec2661a1-f897-4bf5-a9e5-4e4e6c114cd3 | 5 | @Test
public void justPrint()
{
final List<Class<?>> classes = new ArrayList<Class<?>>();
createClassPathFromJVM().withConfiguration( new AbstractHandlerConfiguration()
{
@Override
public void configure()
{
ifMatches( inSubpackage( "o... |
37cd8e63-0f7f-43bf-b3c5-692b9ad8f231 | 4 | public float getMaxValue() {
if(!changeMax)
return lastMax;
changeMax = false;
float maxValue = matrix[0][0];
for(int i = 0; i < row; ++i)
for(int j = 0; j < column; ++j) {
if(matrix[i][j] > maxValue)
maxValue = matrix[i][j];
}
lastMax = maxValue;
return maxValue;
} |
b0296afa-426a-4b5a-accb-57309c6796eb | 2 | public static MedicalNeedEnumeration fromValue(String v) {
for (MedicalNeedEnumeration c: MedicalNeedEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
0064c995-4edf-49c0-8503-ba69a0d31206 | 8 | public Frame7() {
try{
Class.forName(JDBC_DRIVER);
conn = DriverManager.getConnection(DB_URL,USER, PASS);
statement = conn.createStatement();
}catch(SQLException se){
se.printStackTrace();
}catch(Exception e){
e.printStackTrace();
}
setTitle("Blok C, 1 ; 11 - 29");
setDefaultCloseOperatio... |
a156ac9c-2894-4980-87d9-20fa94f213ad | 2 | public Font getStyle()
{
return new Font(mNameSelector.getSelectedItem(), 0
| (mBoldSelector.getState() ? Font.BOLD : 0)
| (mItalicSelector.getState() ? Font.ITALIC : 0), Integer
.parseInt(mSizeSelector.getSelectedItem()));
} |
ead48b04-083c-4a02-a79e-2b6b9012ac64 | 8 | public Object nextValue() throws JSONException {
char c = nextClean();
String s;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... |
5dac92ba-2a10-4745-b939-d4debfccb56f | 5 | @Test
public void TestGetLineNumber() throws IOException {
for (File file : new File("src/test/resources/testprogs").listFiles()) {
if (!file.isFile()) {
continue;
}
String pathBig = file.getAbsolutePath();
LineNumberReader lnr = new LineNumberReader(new FileReader(file));
lnr.skip(Long.MAX_VALUE)... |
8b197501-2a97-4c3c-b017-656c968ca55a | 8 | private void init(String username, String password) {
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
if(!lastFmOn) {
lastFmBox.setSelected(false);
usernameTxt.setText("");
passwordTxt.setText("");
}
SettingsDialog.this.dispose();
}
}... |
519aa072-27a2-4f8a-a573-41c41ff037c4 | 9 | static void blood(Point point, World world) {
if (bloodImg == null) {
bloodImg = new BufferedImage(1200, 800, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = (Graphics2D) bloodImg.getGraphics();
//g2d.setBackground(new Color(0, 0, 0, 0));
//g2d.clearRect(0, 0, 1200... |
58ff9590-3020-4498-9127-b2b8e25f622c | 2 | public static void main(String [] args) {
//Start the timer
double startTime = System.currentTimeMillis();
int i = 0;
int count = 0;
while( count < 10001 ){
i++;
if( isPrime(i) ){
count++;
}
}
System.out.println(i);
//End the timer
double endTimer = System.currentTimeMillis();
//... |
c67a1097-68e0-47d8-b72f-8d5f7ed131ef | 0 | public void setDay(Day day) {
this.day = day;
} |
5d669d24-2aa4-40b2-b652-cc389a7da2f6 | 3 | public int getValue()
{
String valueToReturn = lvalue.getText();
if (valueToReturn.equals("X"))
return -1;
if (valueToReturn.equals("O"))
return -2;
if (valueToReturn.equals("Z"))
return -3;
int integerToReturn = Integer.valueOf(valueToReturn);
return integerToReturn;
} |
c97dd9f4-2187-4053-8d85-5caab3349522 | 8 | public int[] searchRange(int[] A, int target) {
// Start typing your Java solution below
// DO NOT write main() function
int l = 0, r = A.length - 1;
int mid = 0;
while (l <= r) { // find an arbitrary target in array
mid = l + (r - l) / 2;
if (A[mid] > target)
r = mid - 1;
else if (A[mid] < targe... |
92f5a556-2088-43dd-8bd7-917b4ded9e2a | 9 | public void actionPerformed(ActionEvent e) {
JComboBox combo = new JComboBox();
// Figure out what existing environments in the program have
// the type of automaton that we need.
EnvironmentFrame[] frames = Universe.frames();
for (int i = 0; i < frames.length; i++) {
Environment env = frames[i].getEnviron... |
f78a697e-3069-4fce-957f-281a94a879a2 | 2 | public Marker getTss() {
calcCdsStartEnd();
Marker tss = new Marker(this, start + (isStrandPlus() ? 0 : -1), start + (isStrandPlus() ? 1 : 0), 1, "TSS_" + id);
return tss;
} |
74f2755b-e616-4c4e-aa52-d67ee0a83e04 | 9 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
BudgeManagePUEntityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("BudgeManagePU").create... |
43812025-cc13-4274-b534-97ce1535c05a | 3 | public synchronized void receive (Message m) {
long t__recv, dt;
double rate;
long d;
double average, deviation;
count += 1;
if (count == 1)
_t_recv = System.currentTimeMillis();
d = (System.currentTimeMillis() - Long.parseLong(m.getPayload()));
/* Accumulate */
delay += d;
delaysquared += (double) (d * ... |
958a2d8e-99e8-4c2d-b16e-8b47c20d7896 | 0 | @Test
public void test_moveAttackBonus() throws OutOfBoardException{
board.removeAllPawns();
Pawn pawn2 = new Pawn('f', 3, 4, board);
board.addPawn(pawn2);
Pawn pawn1 = new Pawn('e', 4,4,board);
board.addPawn(pawn1);
assertTrue(pawn1.move(Direction.Left).contains("... |
4b93c565-f72b-433a-b1c9-f5133c75f362 | 8 | public Transaction openRead(Transaction me)
{
// don't try read sharing if contention seems high
if (me == null) { // restore object if latest writer aborted
if (writer.isAborted()) {
rVersion.recover();
writer = Transaction.COMMITTED;
}
return null;
}
if (me.attempt... |
ac1a210e-4994-44a1-89db-b0cf30b6e4d4 | 9 | private void loadLib(String name) throws NativeResourceException {
String libName = name.substring(name.indexOf("lib")+3);
try {
if( isARM()) {
//System.err.println("Attempting arm variants");
for(int i=0;i<armLibs.length;i++) {
try {
inJarLoad(armLibs[i]);
//System.err.println("Arm lib... |
ccf2c533-6a2a-473f-a0a5-0525862a30f9 | 6 | private synchronized void setMergeDocStoreIsCompoundFile(MergePolicy.OneMerge merge) {
final String mergeDocStoreSegment = merge.info.getDocStoreSegment();
if (mergeDocStoreSegment != null && !merge.info.getDocStoreIsCompoundFile()) {
final int size = segmentInfos.size();
for(int i=0;i<size;i++) {
... |
73fed795-0195-439b-9058-b507066a1b23 | 9 | public String getStatus()
{
if(value==max)
status="max";
if(value>max*(3/4) && value<max)//75%-100%
status="high";
if(value<max*(3/4) && value>max/2)//50%-75%
status="moderate";
if(value<max/2 && value>max/4)//25%-50%
status="low";
if(value<max... |
3a90a544-a20e-43e9-83c7-3f642bc2580f | 8 | public static void jaxbTransform(String[] args) {
try {
// Get the example into an object we can send
javax.xml.bind.JAXBContext jaxbCtx = javax.xml.bind.JAXBContext.newInstance(Interface.class.getPackage().getName());
javax.xml.bind.Unmarshaller unmarshaller = jaxbCtx... |
7595e43a-3fed-4379-b0c8-461eaca1b669 | 9 | public void generateChunk(int chunkX, int chunkZ) {
byte[] blocks = new byte[32768];//128: 32768, 16: 4096
SimplexOctaveGenerator ground = new SimplexOctaveGenerator(seed, 4);
SimplexOctaveGenerator hills = new SimplexOctaveGenerator(seed, 6);
SimplexOctaveGenerator mountains = ... |
3f165f79-a373-4673-89b3-5fed42b014a6 | 5 | public static BigInt schoolMul(BigInt A, BigInt B) {
assert(A.length() == B.length());
int alen = A.length(), blen = B.length();
int column = 0;
BigInt product = new BigInt(); // answer
for(int b = 0; b < blen; b++) { // for each digit in B
BigInt row = new BigInt();
Unsigned carry = new... |
a5314be1-4477-446b-9881-b1e829d42f25 | 2 | public void addLabel(final Label label) {
if (ClassEditor.DEBUG || CodeArray.DEBUG) {
System.out.println(" " + codeLength + ": " + "label " + label);
}
labels.put(label, new Integer(codeLength));
} |
9df202d9-cc34-4b4d-a565-b23ce8f0d63b | 3 | @Override
public String getDescription()
{
StringBuilder description = new StringBuilder();
description.append("ConditionalRuleList");
if (!rules.isEmpty())
description.append("\n{");
for (ConditionalRule rule : rules)
{
//depends on sub-rules being one line, could refactor to includ... |
ff54cd51-ad6d-4058-96ec-2e96bd70522f | 0 | public FiltroDeAuditoria() {
// TODO Auto-generated constructor stub
} |
3d606575-c474-4ce8-97a4-53486eeb8ccf | 1 | private void setID(int val){
if( val >= m_iNextValidID ) {
m_ID = val;
m_iNextValidID = m_ID + 1;
}
} |
3c23d426-a1b1-4597-9cb2-b1bf074ea8be | 6 | public void createComponent(String text) {
if (freeSpace()) {
int inputs = 0;
int outputs = 0;
if (text.equals(CUSTOM)) { // if file is a Json
JFileChooser fileChooser = new JFileChooser();
int returnValue = fileChooser.showOpenDialog(null);
... |
a0e251ff-dede-4a60-a2e4-0f509b963b4c | 1 | private void restoreSelection() {
select(mSavedSelection, false);
if (mSavedAnchorRow != null) {
mSelection.setAnchor(getIndexOfRow(mSavedAnchorRow));
}
mSavedAnchorRow = null;
mSavedSelection = null;
mNotifyOfSelections = true;
} |
8270c84e-c6a1-44e5-ae6f-6c33e6a35d72 | 7 | public static int getRandomIndex(double[] weights, double randomDraw) {
//check randomDraw
if (0.0 > randomDraw || randomDraw > 1.0) {
throw new IllegalArgumentException("randomDraw is out of range [0,0] :: " + randomDraw);
}
//check weights
double sum = 0.0;
for (int i = 0; i < weights.length; i++) {
... |
03c30734-4ad6-4cae-9351-b8c1d3760d39 | 0 | public static void main(String[] args) {
// TODO Автоматически созданная заглушка метода
Frame frame = new Frame();
new MessagesSender();
GameServerSocket serverSocket = new GameServerSocket();
ViewController viewController = new ViewController(frame, serverSocket);
frame.show();
} |
4c0500eb-0cce-4516-a08b-ee778a85aa90 | 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://down... |
85efe819-e964-4b42-9e76-96a7c1274c82 | 4 | @Override
public float calculateDesire() {
float desire = 0;
Actor actor = ai.getActor();
Player player = registry.getPlayerManager().getPlayerById(target);
if(actor == null || player == null) {
return desire;
}
if(!acto... |
02dc6597-a37e-4715-b72b-87710dcb2fe0 | 0 | public boolean isClosed() { return !this.open; } |
7ce6b172-5b67-41f7-80ef-1e06fc0f703d | 5 | private byte[] buildMessage(Job job, Run run, Phase phase, String status) {
JobState jobState = new JobState();
jobState.setName(job.getName());
jobState.setUrl(job.getUrl());
BuildState buildState = new BuildState();
buildState.setNumber(run.number);
buildState.setUrl(ru... |
b9c99bc3-0988-467a-9e0d-a7abcfc671e1 | 5 | public static byte[] fromHexString(final String hexString) {
if (hexString == null) {
return null;
}
String str = hexString.trim().toLowerCase();
// Strip any leading "0x"
if (str.startsWith("0x")) {
str = str.substring(2);
}
int numChars = str.length();
if (numChars == 0)... |
2f95ea39-603e-48f6-8f2c-695926611c41 | 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://down... |
538e7807-a13c-4488-969c-8ac302b49550 | 3 | public byte[] getStream(){
int end;
int f_back = size_buffer - 1;
for(int i = 0; i < f_back; i ++)
formatStream((cont - f_back + i ) % size_buffer);
for(end = stream.length - 1; end > 0; end--)
if (stream[end] != 0)
break;
byte [] temp = new byte[end];
System.arraycopy(stream, 0, temp,... |
f9cf00d1-2f3b-4597-9342-9192c0e3630e | 4 | public boolean checkReveal(String s, String current){
if (synonyms.containsKey(current)){
ArrayList<String> syns = synonyms.get(current);
for (int i=0; i<syns.size(); i++){
int objDist = EditDistance.calcDistance(syns.get(i), s);
if (objDist <= s.length()/3){
return true;
}
}
return false... |
c6320fe6-98df-4819-bf6a-2366fddd09aa | 6 | public static void assign_position(Vector<AlignmentTriplet> triplets) {
for (AlignmentTriplet triplet : triplets) {
FlaggableCharacterString stream = triplet.getInputstream();
int pos = 0;
for (int i = 0; i < stream.size(); i++) {
FlaggableCharacter c = stream.charAt(i);
if (c.isFlagged()) {
c.setPo... |
06b22890-fdaa-43c1-a171-c327be1a0df5 | 1 | public String doValidate(Object value) {
if (PresenceCheck.isPresent(value))
return null;
return msg;
} |
6274629e-8c7f-4f46-8a2f-26b8874f8c0c | 0 | public String getItemName() {
return itemName;
} |
6a81e28b-389e-4b33-8f11-bddd557aad81 | 0 | public int getWidth() {
return width;
} |
256e3208-29bc-4ed0-8441-2bf286d0e389 | 5 | public void SimpleRunSameGameLinks(String dataFile, String outputFile){
if(localconditions == null)
{
localconditions = new String[0];
}
globalLinkCounter = 0;
L = new LinkSet();
MatchData M = new MatchData(dataFile);
Match m;
int c = 0;
... |
d67c25c5-eacd-4941-b292-e5b43345d328 | 5 | public boolean tjekPeriode(int periodeFra, int periodeTil) throws MonthException {
if (periodeFra < 1 || periodeFra > 12 || periodeTil < 1 || periodeTil > 12) {
throw new MonthException();
} else {
if (periodeFra > periodeTil) {
throw new MonthException();
... |
92b40783-c892-461c-926c-fbbd8732f829 | 6 | public static void main(String[] args) {
String serviceName = null;
String serverIp = null;
int serverPort = 0;
if (args.length != 3) {
System.out.println("Usage: java test.test4Client <ServiceName> <ServerIp> <ServerPort>");
return;
} else {
serviceName = args[0];
serverIp = args[1];
serverPo... |
9256e791-60b4-4a97-b5d9-1acd632d99ea | 1 | private void isEveryOneVoted() {
if (play.villagerPollStatus()) removePlayer();
} |
97adb973-d111-4c1a-809e-c13a12d65132 | 7 | public Object [][] getDatos(){
Object[][] data = new String[getCantidad_Cuentas ()][colum_names.length];
//realizamos la consulta sql y llenamos los datos en "Object"
try{
if (colum_names.length>=0){
r_con.Connection();
String c... |
f4aa8989-bee7-4c75-9716-e92cb96f6976 | 1 | private boolean jj_3_9() {
if (jj_3R_27()) return true;
return false;
} |
4d4ba69f-e9fa-45a4-bb65-3437aed1e8c0 | 4 | @Override
public boolean equals(Object obj) {
if(this == obj)
return true;
if(!(obj instanceof FileHeader))
return false;
FileHeader fileHeader = (FileHeader) obj;
if(
fileHeader.fullPath.equals(fullPath)
// && fileHeader.lastM... |
301f6cfe-b20e-4caa-ae91-4971a1bce338 | 6 | public boolean is_right_user(String username, String publicId) {
if (! this.verify_yubikey_owner) {
log.debug("YubiKey owner verification disabled, returning 'true'");
return true;
}
if (this.id2name_textfile == null) {
log.debug("No id2name configuration. Defaulting to {}.", this.verify_yubikey_owner);
... |
d83a8e62-d128-4ef2-9d38-3154b072115c | 9 | private void preprocessing(Digraph<BrandesKoepfNode,Boolean> graph, List<List<BrandesKoepfNode>> layers) {
Digraph<BrandesKoepfNode,Boolean> reverse = graph.reverse();
for (int i = 1; i < layers.size() - 2; i++) {
List<BrandesKoepfNode> layer = layers.get(i+1);
int k0 = 0;
int l = 0;
for (BrandesKoepfNo... |
714860a5-5b2d-4e2a-b6f3-3ae1419921f2 | 8 | final public void Reference_type() throws ParseException {
/*@bgen(jjtree) Reference_type */
SimpleNode jjtn000 = new SimpleNode(JJTREFERENCE_TYPE);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
Class_type();
} catch (Thr... |
02044f92-f698-42c9-ac4a-c41c55de388f | 3 | public void enemyStats() {// Initializes the enemy pokemons stats
if (GameFile.enemyParty[0].equals("Tykepol")) {// Using Turtwig base
// stats
enemyType = "Fight";
enemyBaseHp = 55;
enemyBaseAtk = 68;
enemyBaseDef = 64;
enemyBaseSpAtk = 45;
enemyBaseSpDef = 55;
enemyBaseSpeed = 31;... |
20b128b7-70b3-4c7d-965d-4eb86818c965 | 8 | private void writeDir2FL(OutputStream out, FLDir dir, String indentTabs) throws UnsupportedEncodingException, IOException {
if (!dir.isShared())
return;
//if (!dir.isRoot() || (dir.isRoot() && dir.hasFile()))
if (!dir.isRoot())
out.write((indentTabs + "<Directory Name=\"" + dir.getName() + "\">\n").getByte... |
d87e97aa-9f99-4d8a-9984-4c632f734c5f | 8 | private boolean canJump()
{
if(redTurn)
{
for(Checker checker: redCheckers)
{
if( (checkJumpLeft(checker)) || (checkJumpRight(checker)) )
return true;
}
}
else if(!redTurn)
{
for(Checker c... |
0326b689-da00-4fd3-92ba-4933d1668208 | 8 | private String formatTime(long millis) {
String formattedTime;
String hourFormat = "";
int hours = (int) (millis / 3600000);
if (hours >= 1) {
millis -= hours * 3600000;
if (hours < 10) {
hourFormat = "0" + hours;
} else {
hourFormat = "" + hours;
}
}
hourFormat += ":";
String minuteF... |
8f96de1b-2b1c-4ec9-ae72-15b29aae99f8 | 6 | public JGImage toDisplayCompatible(int thresh,JGColor bg_col,
boolean fast, boolean bitmask) {
Color bgcol = new Color(bg_col.r,bg_col.g,bg_col.b);
int bgcol_rgb = (bgcol.getRed()<<16) | (bgcol.getGreen()<<8)
| bgcol.getBlue();
JGPoint size = getSize();
int [] buffer = getPixels();
// render image to b... |
fe5c1f08-c2f4-47b4-99ad-6db39425de35 | 9 | public void exchangeSouls(){
int[] nbrOfCards = new int[SoulTomb.getMaxValue()];
for (int i=0; i<players.get(currentPlayer).getNumberOfCards(); i++){
nbrOfCards[players.get(currentPlayer).getCards()[i].getIndex()]++;
}
if (nbrOfCards[0]!=0 && nbrOfCards[1]!=0 && nbrOfCards[2]!=0){
players.get(currentPlaye... |
08e4ca40-9804-4c9b-9bf1-b682820ccc0e | 3 | private CardPower highCards(int[] valueCounts) {
CardPower power = new CardPower().add(0);
int count = 5;
for (int i = valueCounts.length - 1; i >= 0; i--) {
if (valueCounts[i] > 0){
power.add(i);
count--;
if(count <= 0){
break;
}
}
}
return power;
} |
fb4db564-647c-4824-bcd1-96d7a685f4d3 | 2 | @Override
public int compare(Node o1, Node o2) {
if (o1.getHeuristic()> o2.getHeuristic()) {
return 1;
}
else if (o1.getHeuristic() == o2.getHeuristic()) {
return 0;
}
else {
return -1;
}
} |
b7b50c4e-5eeb-4d98-96d9-2c0777ded953 | 9 | public static ListNode mergeTwoLists(ListNode l1, ListNode l2) {
if (null == l2) return l1;
if (null == l1) return l2;
ListNode ah = l1;
ListNode bh = l2;
ListNode rh = null;
ListNode p = null;
while (null != ah && null != bh) {
if (ah.val < bh.val) {
if (null ==... |
5df8d663-0487-445e-9543-13d41329cafa | 9 | public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
int times = 1;
StringBuilder out = new StringBuilder();
int nCase = in.nextInt();
RC = new int[2];
for (int i = 0; i < nCase; i++) {
RC[0] = in.nextInt();
RC[1] = in.nextInt();
dp = new int[RC[0]][RC[1]... |
b69a01ac-b86b-443d-b093-a7343e050189 | 8 | Tag constructTag(List<Token> toks) throws SDLParseException {
if(toks.isEmpty())
// we have to use -2 for position rather than -1 for unknown because
// the parseException method adds 1 to line and position
parseException("Internal Error: Empty token list", lineNumber, -2);
Token t0 = toks.get(0);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.