method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3393eb32-5e01-4bbe-9da6-e281882eff80 | 1 | public final void removeGameLayer(GameLayer gameLayer) {
if (!gameLayers.containsKey(name)) {
logger.error(new NullPointerException(),
"Died within removeGameLayer. There was no corresponding layer with the name :: ", name);
} else {
removeLayers.add(gameLayer);
}
} |
a5db9794-378e-4d1a-83a8-ec3f565fcc4c | 9 | public BreakPoint commitMinPenalty(int space, int lastSpace,
int minPenalty) {
if (startPos == -1 || lastSpace > endPos - startPos
|| minPenalty == 10 * (endPos - startPos - lastSpace)) {
/* We don't have to break anything */
startPos = -1;
childBPs = null;
return this;
}
int size = c... |
8bfab072-459a-46aa-a917-c286af2681d3 | 0 | @FXML
private void handleTorokuButton(ActionEvent event) {
getMessageBox().userAction = UserAction.SUBMIT;
hide();
} |
3579628a-99c0-4c83-8b1d-d2ff074510c6 | 7 | public void StartServer(int port) {
try {
serverSocket = new ServerSocket(port);
LOGGER.log(Level.INFO, "Serwer rozpoczal dzialanie na porcie {0}", port);
while (true)
{
Socket socket = serverSocket.accept();
LOGGER.log(Level.IN... |
c14661da-70ff-49d6-b24b-ccaa2777eadb | 3 | public void alterarSenha() {
if ((user.getPro_senha().equals(senhaAntiga) && novaSenha.equals(validatorSenha)) || user.getPro_senha().equals("123")) {
saveNovaSenha(novaSenha);
} else {
facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Senha atual não coincidente", "A senha... |
8c1905f3-f443-4e16-a114-22039746adc5 | 5 | private int analyze(File f, Pattern specFileRegex) {
int c = 0;
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(f));
String line;
while ((line = reader.readLine()) != null) {
if (specFileRegex.matcher(line).matches()) {
specialLines.add(new QCLine(line, this));
... |
461157a6-e35b-48c8-bd3b-6346086b6419 | 0 | public String getIdentifier() {
return identifier;
} |
cdec1284-ce23-4d1a-9e37-c15e41bf8e60 | 1 | @Override
public Collection<TrendBar> getBars(Symbol symbol, PeriodType periodType, long from, long to) {
if (to < from) {
throw new IllegalArgumentException("To can not be earlier from");
}
Collection<TrendBar> trendBars = trendBarDao.getTrendBars(symbol, periodType, from, to);
... |
bfadd782-391e-4c42-849a-71eedf969ccc | 2 | public void initGUI()
{
// Låt användare välja operation
// Ta in två heltal
System.out.println(" - Choose operation -"
+ "\n 1. Addition"
+ "\n 2. Subtraction"
+ "\n");
Scanner scanner = new Scanner(System.in);
String i2 = scanner.nextLine();
int i = Integer.valueOf(i2);
System.out.printl... |
c8ed184e-8ece-42ee-b8e9-05f748566129 | 7 | private boolean parseLine(String nextLine, int line){
if(nextLine.length()==0 || nextLine.toCharArray()[0] == COMMENT)
return false;
if(nextLine.toCharArray()[0]==SIZE_MAP){
System.out.println("Map:");
try{
String[] size_map = nextLine.split(" ");
size_map = size_map[1].split("x");
x = Integer.... |
2202f05b-f063-4290-8cd3-922aaab77fc0 | 4 | void tryToAttackTarget(Entity target) {
if (target == null) {
throw new IllegalArgumentException();
}
boolean withinDistance = isLocationWithinDistance(target.getLocation(),
attack.getRange());
if (attack.isReady() && withinDistance && !isStunned()) {
attackTarget(target);
}
} |
91f5493c-fb42-4551-86c2-c3ff49d91c76 | 7 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
button=!button;
if(button){
List<IPMACPair> send = new LinkedList<IPMACPair>();
int i=listSelectionModel.getMaxSelectionIndex(), j=listSelectionModel.getMinSelectionIndex();
while(true){
if(listSelectionModel.isSelectedIndex(i))
... |
dc706cbc-1f47-4e7e-8c41-54ee600e809d | 4 | public static String toString(int direction)
{
switch(direction)
{
case 0: return "North 0";
case 1: return "East 1";
case 2: return "South 2";
case 3: return "West 4";
default: throw new DirectionOutOfBoundsException();
}
} |
a8266827-5c74-436e-ad36-025d670f947b | 9 | private static double[] calculateMeanBoostrapValue( final Phylogeny t ) {
double b = 0;
int n = 0;
long sum = 0;
double x = 0.0, mean = 0.0;
final double[] da = new double[ 2 ];
final Vector<Double> bv = new Vector<Double>();
PhylogenyNode node = null;
Pre... |
bbeb1241-4b0b-447b-a2d7-b06ae3adcec2 | 4 | public void dispatch(Message m) {
if (this.isSilenced()) {
return;
}
if (m.getTarget() != null) {
if (this.clients.contains(m.getTarget())) {
m.getTarget().send(m);
return;
}
}
synchronized(this.clients) {
int l = this.clients.size();
for (int i = 0; i < l; i++) {
this.clie... |
6df5f9ba-6265-4d34-bc46-e2eca85ba75b | 2 | public static String getFileExtension(String fileName) {
String extension = null;
if (fileName != null && fileName.indexOf(".") >= 0) {
extension = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length());
}
return extension;
} |
26b91fe4-36ea-46f2-9e1c-6af7d34f9949 | 3 | private static void clarityInputValidator() {
while (!validInput) {
try {
System.out.print("You selected to search by clarity. Please enter a clarity: ");
clarityInput = actionInput.next();
clarityInput.toUpperCase();
System.out.println("You entered: " + clarityInput);
validInput = tru... |
795ae521-9c8e-4cc2-b462-1b81af7bbcb7 | 9 | private boolean processMessageCommandDebug(String s, String s1)
{
boolean flag = false;
int i = -1;
int ai[] = new int[17];
do
if(++i == 0)
ai[i] = s1.indexOf(" ");
else
ai[i] = s1.indexOf(" ", ai[i - 1] + 1);
while(ai[i... |
6f535f69-1c14-4a3e-92b4-bd65b56d5685 | 6 | public static <E> FunctionExecutor<Void> createRemove(final FeatureDefinition<? extends Property<? extends Collection<E>>> propertyDefinition) {
return new FunctionExecutor<Void>() {
@Override
public Void invoke(FunctionInvocation<Void> invocation, Object... arguments) throws ExecutorI... |
7e8ece53-2254-437a-a84d-90db04d42049 | 3 | private void offerToMergeToNewProject() {
int response = JOptionPane.showOptionDialog(myCP, "Would you like one of the projects to merge"
+ "to be the project you just created?", "Merge More Projects", JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE, null, null, JOptionPane.YES_OPTION);
... |
83d90551-8340-40d6-9a71-cfddf7dddf63 | 3 | private int pickFruit(int [] platter)
{
// generate a prefix sum
int[] prefixsum = new int[NUM_FRUITS];
prefixsum[0] = platter[0];
for (int i = 1; i != NUM_FRUITS; ++i)
prefixsum[i] = prefixsum[i-1] + platter[i];
int currentFruitCount = prefixsum[NUM_FRUITS-1];
... |
64774290-50e7-4680-9b5c-22f3b7e6b70d | 2 | public static void main(String[] args)
{
GeoIpParser parser = new GeoIpParser();
try
{
List<GeoIPv4Adress> geoIPv4AdressList = parser.parse(new File("geo-ip.xml"));
for(GeoIPv4Adress adress : geoIPv4AdressList)
{
System.out.println(adress);
}
}
catch(Exception e)
... |
4ce1f330-3030-4d6b-a9eb-d9e94b082796 | 1 | @RequestMapping(value = "/event-branch-object/{id}", method = RequestMethod.GET)
@ResponseBody
public EventBranchObjectResponse eventBranchObject(
@PathVariable(value = "id") final String idStr
) {
Boolean success = true;
String errorMessage = null;
EventBranch eventBranc... |
72a966ec-a2bf-4ead-8ce4-f8c90e6cc86f | 6 | public static void main(String[] args){
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... |
93485753-e52c-4297-8b10-dc8b09fea5ea | 2 | public static boolean stockExists(String tickername, ArrayList<Stock> stocks) {
tickername = tickername.toUpperCase();
for (Stock e : stocks) {
if (e.getTickername().equalsIgnoreCase(tickername)) {
return true;
}
}
return false;
} |
77b8d1b6-74bf-4e10-905f-77e09ce58597 | 4 | public static Bitmap loadBitmap(String location){
try{
BufferedImage img = ImageIO.read(AssetLoader.class.getResource(location));
int w = img.getWidth();
int h = img.getHeight();
Bitmap result = new Bitmap(w, h);
img.getRGB(0, 0, w, h, result.pixels, 0, w);
for(int i = 0; i < result.pixels.length; i... |
ec350bc3-ea9b-4405-bfc8-a6867fb740f2 | 6 | public void decreaseKey( Position<T> pos, T newVal )
{
if( pos == null )
throw new IllegalArgumentException( "null Position passed to decreaseKey" );
PairNode<T> p = (PairNode<T>) pos;
if( p.element == null )
throw new IllegalArgumentException( "pos already deleted" );
if( ... |
f600db7d-eadd-4d74-b88c-821f7e5578cf | 8 | @Override
public List<List<String>> getArtificialData(String fileName) {
List<List<String>> ArtificialData = new ArrayList<List<String>>();
String line = "";
log.info("Start to get man-made datas in "+fileName+"... ...");
//Get Column Name list
try {
FileReader fr = new FileReader(new File(artificialFolderP... |
e21362e9-ba69-4306-bd3d-7e92a631160d | 0 | UnicodeReader(InputStream in, String defaultEnc) {
internalIn = new PushbackInputStream(in, BOM_SIZE);
this.defaultEnc = defaultEnc;
} |
4f543fd5-d66d-49d2-be08-9d3d56da3026 | 6 | private void validateErgebnis(String toreA, String toreB) {
try {
int a = Integer.parseInt(toreA);
int b = Integer.parseInt(toreB);
if (a < 0 || a > 10 || b < 0 || b > 10 || a == b) {
getErrorMessages().add(
"Tore/Ergenis machen keinen Sinn. Es muss einen Gewinner geben und es können maximal 10 Tor... |
50da6121-05e3-4430-81fd-11e057e788d2 | 9 | public static void encode(Map<Integer, ZState> states) throws Exception{
int places = getPower(states)[0];
int [][][] table = initTransitionTable(states);
List<SynchroState> template = initTamplate(places);
addToTemplate(template, states.get(0), 0);
Map... |
5cd20559-18ad-49c3-9e5d-702964347726 | 5 | void runLadder(int selectedPlayerNumber) {
Direction lastMovedDirection = Direction.VERTICAL;
Coordinate cp = new Coordinate(selectedPlayerNumber - 1, 0);
System.out.println("■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■");
while (cp.getY() < columnLength) {
displayCurrentPoint(cp);// 루프 돌 때마다 현재 상태를 ... |
00d454d9-043b-4561-b0ae-5366c9eb119d | 2 | public static void main(String[] args) {
Object[] options = {"O","X"};
int n = JOptionPane.showOptionDialog(null,"Would you like to be X's or O's?","Tic-Tac-Toe",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,null,options,options[0]);
if(n==1) {
play="X";
comp="O"... |
77c49c31-4c28-45ce-b961-8d5f58d1a685 | 3 | public int getMatchSearchResult(String search){
PreparedStatement st = null;
ResultSet rs = null;
try {
conn = dbconn.getConnection();
st = conn.prepareStatement("SELECT * FROM match_record_2013 where event_id = ? AND match_number = ?");
st.setInt(1, getSelect... |
3229c36f-b3d6-4108-9d68-038aefbf884f | 1 | public final EsperParser.else__return else_() throws RecognitionException {
EsperParser.else__return retval = new EsperParser.else__return();
retval.start = input.LT(1);
Object root_0 = null;
Token ELSE36=null;
EsperParser.statements_return statements37 =null;
Object... |
696df3e6-30d0-4501-ac0e-9f9461c6a61d | 5 | @Override
public String getCommand() {
Scanner inFile = new Scanner(System.in);
String command;
boolean valid = false;
do {
command = inFile.nextLine(); //gets input
command = command.trim().toUpperCase(); //changes it to uppercase
if ("H".equals(c... |
3793d6a9-6886-4873-8355-bd39b449e5de | 3 | @Override
public int eval()
{
if ( m_op == Op.PLUS )
return m_exp1.eval() + m_exp2.eval();
else if ( m_op == Op.MINUS )
return m_exp1.eval() + m_exp2.eval();
else if ( m_op == Op.TIMES )
return m_exp1.eval() * m_exp2.eval();
else
re... |
aa3e0a61-7ae8-48e7-9f2f-0523a54e1651 | 8 | public MyCurve getCubicCurve2D() {
MyCurve result = new MyCurve(new CubicCurve2D.Double(start.getX(), start.getY(), start.getX(), start.getY(),
end.getX(), end.getY(), end.getX(), end.getY()));
if (result.intersects(forbiddenRect) || result.intersects(forbiddenCurves)) {
final Set<Point2D.Double> all = new H... |
a6e69d7b-7b9e-48c2-b61a-483dd51c0aee | 3 | public void add(Object arg0) {
// TODO Auto-generated method stub
int i = 0;
if (list.isEmpty()) {
list.add(arg0);
} else {
while (i < list.size()) {
if (c.compare(arg0, list.get(i)) < 0) {
break;
}
i++;
}
list.add(i, arg0);
}
} |
e432e8c1-1ef9-4925-8b54-2b11e32d784f | 5 | private boolean broadcastRequest() {
System.setProperty("java.net.preferIPv4Stack", "true");
Enumeration<NetworkInterface> niEnum = null;
try {
niEnum = NetworkInterface.getNetworkInterfaces();
} catch (SocketException e) {
log.crit("Failed to get network interfaces for broadcast!");
log.excp(e);
... |
fb611b7c-6fe6-4294-a960-9de2a95c7035 | 1 | public void resetItemPile(int z, int x, int y) {
GroundTile groundTile = groundTiles[z][x][y];
if (groundTile != null) {
groundTile.itemPile = null;
}
} |
8a31253a-3580-47a1-9940-b7ee5ddb08ac | 4 | public static void printStat3(String string) {
if (string == null || string.isEmpty()) {
System.out.println("Null or empty");
return;
}
char[] temp = new char[1];
string += '\u0000';
StringBuilder b;
b = new StringBuilder();
for (int i = 0,... |
b0c7fcd8-6f02-42bc-9e9e-b443124604a4 | 9 | public int[] intersection(int[] nums1, int[] nums2) {
if (nums1 == null || nums1.length == 0 || nums2 == null || nums2.length == 0) {
return new int[0];
}
Arrays.sort(nums1);
Arrays.sort(nums2);
int i = 0, j = 0;
Set<Integer> set = new HashSet<>();
while (i < nums1.length && j < nums2.length) ... |
70537029-671c-4fb0-a780-a47267e3e284 | 1 | public boolean atTop()
{
if(y < yMid)
return true;
return false;
} |
acb14307-1d8e-46e2-b228-72f3e11bc0ea | 5 | private void removeDragTransfer(Transfer transfer){
if (dragTypes.length == 1) {
dragTypes = new Transfer[0];
} else {
int index = -1;
for(int i = 0; i < dragTypes.length; i++) {
if (dragTypes[i] == transfer) {
index = i;
break;
}
}
if (index == -1) return;
Transfer[] newTypes = new Transfer... |
beb8f00d-bd53-4fc4-9810-1c3c24236a1f | 9 | public void unMove() {
plrTurn ^= (0^1);
if (gameState != STATE_PLAYING) {
if (gameState >= STATE_WON)
scores[gameState - STATE_WON]--;
gameState = STATE_PLAYING;
}
CkMove m = (CkMove) history.getMove(moveNumber - 1);
int start = m.startPosition();
int endPiece = 0;
int jumpCount = m.totalJ... |
3594bdb4-6367-4047-9654-d9046d8143a6 | 6 | public void run() {
long cRT = 0, nRT;
long cST = 0, nST;
while( !Thread.interrupted() ) {
nST = sim.getNextAutoUpdateTime();
if( cST == 0 ) {
cST = nST;
cRT = nRT = System.currentTimeMillis();
} else {
cRT = System.currentTimeMillis();
nRT = nST == Long.MAX_VALUE ? Long.MAX_VALUE : cRT ... |
5130f283-c1a8-4380-bade-35b1e28c5e6b | 9 | <T> Object createArbitraryFor(Class<T> arbitraryT) throws TestException {
if (arbitraryT.isEnum()) {
T[] enumCs = arbitraryT.getEnumConstants();
return enumCs[choose(0, enumCs.length - 1)];
} else if (arbitraryT.isArray()
&& arbitraryT.getComponentType().isPrimitive())... |
5cac3042-27c9-4939-bb7d-2a7551f7bf2e | 4 | private void waitForTimers( final long timeElapsed ) {
nextSleepInterval = Long.MAX_VALUE;
listeners.putAll( newListeners );
for( final Iterator<Entry<TimerListener, Long>> iter = listeners.entrySet().iterator(); iter.hasNext(); ) {
final Entry<TimerListener, Long> entry = iter.next();
final TimerListene... |
7668e751-740f-4638-88f1-7aebb975d15c | 8 | public MinimizerDialog(MolecularModel m) {
super(JOptionPane.getFrameForComponent(m.getView()), "Energy Minimizer", true);
String s = MolecularContainer.getInternationalText("EnergyMinimizer");
if (s != null)
setTitle(s);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
model = m;
JPanel panel = new JPanel... |
8fa5659f-b9bb-4e8a-a3ed-f618183e8543 | 1 | private static void loadUsernameFile() throws IOException
{
BufferedReader br = new BufferedReader(new FileReader("Users.txt"));
String s;
while((s = br.readLine()) != null)
{
users.add(s);
}
br.close();
} |
44faee80-eb66-4a68-af8d-c1db7d9633b4 | 0 | private void writeObject(ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
stream.writeLong(callObjectId);
stream.writeObject(meta);
stream.writeObject(data);
stream.writeBoolean(complete);
stream.writeBoolean(error);
stream.writeLong(startLiveTime);
stream.wr... |
a97eb6ac-84ea-4e07-9a1b-d01fd5586fa2 | 6 | private User readUserData(JsonReader reader) throws IOException {
User currentUser = new User();
reader.beginObject();
while (reader.hasNext()) {
String key = reader.nextName();
if (key.equals("id")) {
currentUser.setId(reader.nextInt());
} else if (key.equals("name")) {
currentUser.setName(reade... |
3daf893a-3db7-464c-bb26-c379ca04751c | 4 | public void customerAdjust()
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String commandArg = null;
System.out.println("Please enter the customer ID.");
try{
commandArg = br.readLine();
} catch(IOException ioe) {
System.out.println("Error reading customer ID.Exiting.... |
8675a615-27ac-464f-81c2-b613614881b7 | 3 | public MatchSaveData(Match match) {
Board board = match.getBoard();
unitPositions = new Unit[board.getGridWidth()][board.getGridHeight()];
for (int i = 0; i < board.getGridWidth(); i++) {
for (int j = 0; j < board.getGridHeight(); j++) {
if (board.getTile(i, j).hasUnit()) {
unitPositions[i][j] = board... |
9c812c21-423e-4a40-bbb5-fa6cdcbb1c15 | 0 | public TransactionGenerator(int numTrxs, int numCards, int numProducts) {
} |
57dff082-495f-424f-aeb1-289c2c39eb8a | 6 | public Currency search(String string) throws CurrencyNotFoundException, MultipleCurrencyException {
for (Currency currency : set) {
if (currency.getCode().equalsIgnoreCase(string)) return currency;
if (currency.getSymbol().equalsIgnoreCase(string)) return currency;
if (curren... |
83b50181-4dee-4a91-a9fd-50add16f7193 | 3 | public boolean onScreen() {
return (rect.x + rect.width >= 0 && rect.x <= world.getScreen().getWidth() &&
rect.y + rect.height >= 0 && rect.y <= world.getScreen().getHeight());
} |
dba01198-99d5-4642-818b-1b265fe162bd | 6 | public String printXML(boolean XMLProject) {
String XMLString = "";
if (!printed) {
XMLString += "<link.name>" + this.name + "</link.name>\r\n";
XMLString += "<link.id>" + this.id + "</link.id>\r\n";
if (p1 != null) {
XMLString += "<from>\r\n";
... |
7d3abb0e-d8b0-44e0-b1c2-c3fe4d1eddb6 | 7 | public UIChangeList evaluateInput(Point in) {
//Be careful because in comes from the UI so it is
// y, x
ChessMove curMove = new ChessMove(board.getBlock(in).getPiece(), in);
UIChangeList ret = new UIChangeList();
/*
* If they fail to pass a static rule, it's because it's either not their turn
* or they... |
51e50a8c-7220-4f6d-a391-bdbfdeaeb7f9 | 1 | @Override
public void kiihdyta(double vaakaNopeus, double pystyNopeus){
for (KentallaOlija osa : osat){
osa.kiihdyta(vaakaNopeus, pystyNopeus);
}
} |
8c7582c9-6b1a-4305-9f85-d9b63634ad45 | 4 | @Override
public E remove(int i) throws IndexOutOfBoundsException {
if (i < 0 || i > (size - 1))
throw new IndexOutOfBoundsException();
size--;
E removed = elements[getIndex(i)];
if (i == index_of_first)
index_of_first++;
else {
for (int index = i; index < size; index++) {
elements[getIndex(inde... |
ee46a8da-eac8-400d-9a3c-400117a0941e | 7 | public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int numberOfDataSets = scanner.nextInt();
scanner.nextLine();
for (int i = 0; i < numberOfDataSets; i++) {
StringTokenizer timeTokenizer = new StringTokenizer(scanner.nextLine(), ":");
if (timeTokenizer.countTokens() != 3)
... |
e91f63ef-0c01-4fe6-8fbb-18f3fd16530a | 8 | public static void main(String... args) throws IOException {
MyScanner sc = new MyScanner();
int n = sc.nextInt();
int[] err = new int[n];
for (int i = 0; i < n; i++) {
err[i] = sc.nextInt();
}
Arrays.sort(err);
int[] err1 = ... |
007ffc9d-e7f1-4c5b-a108-f88b8340447e | 7 | public void addSubGroups(final BufferedReader br) throws IOException {
do {
SubGroup subGroup = new SubGroup(Dars.input);
while((Dars.input = br.readLine()) != null && (Dars.input.contains("SUB TITLE") || Dars.input.contains("SUB SUMMARY"))) {
if(Dars.input.contains("SUB TITLE")) {
subGroup.addTitle(Da... |
3db94541-65b8-41b4-9180-d21039242528 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Packet other = (Packet) obj;
if (operationCode != other.operationCode)
return false;
if (!Arrays.equals(parameters, other.parameters))
re... |
df70b728-f4ec-4b09-a620-23d249ae8704 | 8 | public void keyReleased(KeyEvent e) {
int keyCode = e.getKeyCode();
synchronized (LiveSystemCopyMutex) {
PlayerShip hero = physicsLS.hero;
if (hero.status == ShipStatus.ALIVE) {
if (keyCode == KeyEvent.VK_UP) {
... |
02ca53cb-8bb5-438e-b5d0-b921c43c304b | 7 | public static void saveKanjiToFile() throws IOException{
KjBinaryWriter writer = new KjBinaryWriter(VOCABULARY_FILE_NAME);
ArrayList<KjKanji> tempStorage = KjStorage.getInstance().getList();
writer.write(tempStorage.size(), 4);
for(int i = 0; i < tempStorage.size(); i++) {
KjKanji word = tempStorage.get(i... |
bdea6ab4-bde9-4a0c-b92a-bf3c89b96d78 | 7 | protected String defuzzifier(String name) {
if ("centroid".equals(name)) {
return Centroid.class.getSimpleName();
}
if ("bisector".equals(name)) {
return Bisector.class.getSimpleName();
}
if ("lom".equals(name)) {
return LargestOfMaximum.class.... |
ee686204-734f-4d6a-ae75-06bc869ea44c | 0 | public BruteParser getParser() {
return (BruteParser) super.getSource();
} |
5b58a527-01c5-48a2-96c4-f5d98731f8b4 | 8 | public static void send( String xml1 ){
xml=xml1;
if(askForName){
global.conf.pastebinPane.remove(global.conf.pastebinConf);
int ok=JOptionPane.showConfirmDialog(global.Window, global.conf.pastebinConf, "Send", JOptionPane.OK_CANCEL_OPTION);
global.conf.pastebinPane.s... |
741e23da-159e-4c8f-9d1c-4a02e2af052c | 2 | public ProduktBatchDTO getProduktBatch(int pbId) throws DALException {
ResultSet rs = Connector.doQuery("SELECT * FROM produktbatch WHERE pb_id = " + pbId);
try {
if (!rs.first()) throw new DALException("Produktbatchen " + pbId + " findes ikke");
return new ProduktBatchDTO (rs.getInt(1), rs.getInt(2), rs.getI... |
eabafb8c-3bda-42dd-9d64-bd79b5d2d516 | 2 | private void showPicture() {
boolean[][] bricks = state.getBricks();
for (int i = 0; i < bricks.length; i++) {
for (int j = 0; j < bricks[i].length; j++) {
bricks[i][j] = false;
}
}
} |
20729f90-2f03-4174-9977-753128aaddab | 0 | public void pass() {
isBattingFirstTurn = !isBattingFirstTurn;
} |
d159b9b0-bb34-4d15-8f73-4d9ba1e0daee | 6 | float getVerticalAlignment( ) {
String align = (String) fElement.getAttributes().getAttribute(HTML.Attribute.ALIGN);
if( align != null ) {
align = align.toLowerCase();
if( align.equals(TOP) || align.equals(TEXTTOP) )
return 0.0f;
else if( align.equals(Base64ImageView.CENTER) || align.equals(MIDDLE)
... |
6999412f-da40-4a40-9e57-6267c296055b | 9 | public int getSourceLineNumber(int _start, boolean _exact) {
final Iterator<StartLineNumberPair> i = getPool().iterator();
if (i.hasNext()) {
StartLineNumberPair from = i.next();
while (i.hasNext()) {
final StartLineNumberPair to = i.next();
... |
4c51eda7-5441-4cb6-86b9-46c45b72c9fc | 1 | public void addSubClass(ClassIdentifier ci) {
knownSubClasses.add(ci);
for (Iterator i = virtualReachables.iterator(); i.hasNext();)
ci.reachableReference((Reference) i.next(), true);
} |
3c686a33-4e20-476d-8a9c-6df38f8ef77e | 7 | public void updateReactToCloakedPyroState(double s_elapsed) {
if (!target_unit.isVisible()) {
return;
}
can_growl = true;
if (!target_unit.isInMap()) {
initState(RobotPilotState.INACTIVE);
can_growl = true;
}
else if (target_object_room.equals(current_room)) {
if (target_... |
8dc64226-fd5c-443b-b01b-68e7e234c44a | 5 | private void FormaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FormaActionPerformed
// TODO add your handling code here:
if(f && (Vias.getSelectedItem()!="Vias de administracion") && (Forma.getItemCount())!=0){
if(Forma.getSelectedItem().equals("Forma")){
... |
fafface4-a589-4230-bcdd-7d0e3edc662f | 7 | Instantiation(final Instantiation prev, final Subroutine sub) {
previous = prev;
subroutine = sub;
for (Instantiation p = prev; p != null; p = p.previous) {
if (p.subroutine == sub) {
throw new RuntimeException("Recursive invocation of " + sub);
... |
5015b390-4120-4a2b-b4ab-06ced3ba80b3 | 6 | private void handleCollision()
{
//Snake - Meat meatCollisions
meatCollision = snake.getHead().getI() == meat.getI() && snake.getHead().getJ() == meat.getJ();
if(meatCollision)
{
meat.generateNewPosition();
score ++;
snake.grow(CELL_GROWTH_PER_MEAT_EATEN, direction);
increaseSpeed();
}
//Snak... |
dfa6de73-4786-4f6a-a6f6-eca94bcafa0e | 0 | @Override
public String getDesc() {
return "SoulStrike";
} |
73aa6edd-64bf-41bc-9a3b-b5de1e533b61 | 8 | public boolean stem() {
int v_1;
int v_2;
int v_3;
int v_4;
// (, line 157
// do, line 159
v_1 = cursor;
lab0: do {
// call prelude, line 159
if (!r_prelude()) {
break lab0;
}
} while (false);
cursor = v_1;
// do, line 160
v_2 = cursor;
lab1: do {
// call mark_regions, line 160... |
c5c01e24-10d0-477d-9b85-6c0d001cf505 | 8 | public static void main(String[] args) {
Scanner scanIn = new Scanner(System.in);
System.out.print("Enter a value: ");
Integer a = scanIn.nextInt();
System.out.print("Enter b value: ");
Integer b = scanIn.nextInt();
System.out.print("Enter c value: ");
Integer c = scanIn.nextInt();
System.out.println... |
227021b9-09b8-412b-9d91-9a241f95563e | 7 | @Test public void testGetSubset() {
LongIntervalMap<long[]> map = new LongIntervalMap<long[]>();
StupidLongIntervalMap stupid = new StupidLongIntervalMap();
RandomIter iter = new RandomIter( getSeed(), 0, 1000 );
final int testCount = 2000;
final int subtestCount = 100;
... |
c36d902b-0040-4fc9-a729-c67d4080e39a | 1 | @Override
public boolean getKey(int code) {
return glfwGetKey(inputSource, code) == GL_TRUE ? true : false;
} |
604f2b6c-5f1b-48b6-ac25-69e0638910d0 | 4 | public Component getListCellRendererComponent(
JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)... |
36797fc6-5526-4312-9066-f1b54337120e | 7 | private void growDTNode(DecisionTreeNode node, int levelCount, int maxLevel) {
if (levelCount >= maxLevel) {
return;
}
if (questions == null || questions.isEmpty()) {
throw new NullPointerException(
"question list is empty or null at level " + levelCount);
}
int bestQuestionIndex = 0;
double best... |
05d755a5-a04a-416a-a1d4-e46b06d4f7dd | 3 | protected void mkBus (String busname, int busnum)
throws IOException, SecurityException
{
USB bus;
bus = new USB (directory_prefix, busname, busnum, listeners, self);
if (trace)
System.err.println ("mkBus " + bus);
busses.put (busname, b... |
cd923060-d6e1-4c04-88de-159f5ef6ecd6 | 3 | boolean isWestward() {
if ( (this == northwest)
|| (this == west)
|| (this == southwest)
) {
return true;
}
return false;
} |
7af48965-c261-4f4e-ab91-b1e0d72ec75f | 2 | public void uimsg(String msg, Object... args) {
if (msg == "cancel") {
anim = new Cancel();
ui.grabmouse(null);
ui.grabkeys(null);
} else if (msg == "act") {
anim = new Chosen(menuOptions[(Integer) args[0]]);
ui.grabmouse(null);
ui.grabkeys(null);
}
} |
165c5192-70a5-4e7b-8a2a-2a113a36b2bf | 2 | public static void sendPlayer( String player, Server server, boolean serverConnect ) throws SQLException {
BSPlayer p = PlayerManager.getPlayer( player );
if ( serverConnect ) {
setPlayerToForcedChannel( p, server );
}
ByteArrayOutputStream b = new ByteArrayOutputStream();
... |
931690ab-1edd-4667-b63c-d0fbcccc6c98 | 9 | public static void runInstrumentedManyTimes(final MultithreadedTestCase test, int count,
int[] failureCount) throws Throwable {
int failures = 0;
Throwable t = null;
boolean failed = false;
System.out.println("Testing " + test.getClass());
for (int i = 0; i < count; i++) {
try {
runOnce(test)... |
51f0ce5a-d870-43c1-b32f-2ff069b49340 | 6 | public boolean skipTo(int target) throws IOException {
for(;;) {
if (current != null && current.skipTo(target-base)) {
return true;
} else if (pointer < readers.length) {
if (tenum != null) {
SegmentMergeInfo smi = tenum.matchingSegments[matchingSegmentPos++];
... |
f2b1cec7-8994-4a03-958d-525d1e739f20 | 8 | public void resize(int sx,int sy){
int ns = sx*sy;
if (data==null || ns!=data.length){
if (ns>0)
data=new float[ns];
if (ns==0)
data=null;
if (ns<0)
throw new ArrayIndexOutOfBoundsException(ns);
width=sx;
height=sy;
}
if (offsets==null || offsets.length!=height)
offsets=new int[hei... |
2ace0859-726e-48ec-9163-7eb5045bf324 | 5 | public ArrayList<Road> getNeighborRoads(Intersection intersection)
{
ArrayList<Road> neighborRoads = new ArrayList();
ArrayList<Road> roads = level.roads;
int x = intersection.x;
int y = intersection.y;
for (int i = 0; i < roads.size(); i++)
{
// ... |
fa19ca41-81c3-4fb5-b801-84f5706f8b6e | 6 | public static String unescape(String string) {
int length = string.length();
StringBuilder sb = new StringBuilder(length);
for (int i = 0; i < length; ++i) {
char c = string.charAt(i);
if (c == '+') {
c = ' ';
} else if (c == '%' && i + 2 < len... |
7725def9-920e-4142-b1dd-8fa4852f2ce7 | 6 | public ScrabbleBoard ( ) {
this.isReady = false ;
this.charGrid = new char[ this.boardHeight ][ this.boardWidth ] ;
for ( int i = 0 ; i < this.boardHeight ; i++ ) {
for ( int j = 0 ; j < this.boardWidth ; j++ ) {
this.charGrid[ i ][ j ] = this.blank ;
}
}
this.valueGrid = n... |
0c912c70-aae9-4e6b-b163-f8fc23ad431a | 3 | private static Animation getAnimation(String s) {
Animation ret = null;
if ((s != null) && !s.equals("")) {
try {
ret = Animation.valueOf(s.trim().toUpperCase());
} catch (IllegalArgumentException e) {
ret = null;
}
}
... |
f4d3df21-6fc3-4b0c-8f71-1bac32630a39 | 7 | public static int svm_check_probability_model(svm_model model)
{
if (((model.param.svm_type == svm_parameter.C_SVC || model.param.svm_type == svm_parameter.NU_SVC) &&
model.probA!=null && model.probB!=null) ||
((model.param.svm_type == svm_parameter.EPSILON_SVR || model.param.svm_type == svm_parameter.NU_SVR) &&... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.